????? ????? SQL Server 2005 ? SQL Server 2000 ??????? ??????? ?????? ?? 2007

?????? ????????? ?????? ?????????
???? ???????: 931975 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

????? ???

?? ????? 2005 ????? Congress S. U. ????? ??? ??????. ??? ????? ????? ?? ?? ' ????? ????? ' ? ' ????? ?????? ??????? ?????? (DST). ??? ??? ????? ?? 2007 ? ???? ??? ???????? ??????? ??????? DST ?? ???? ????? ????? ???? ???? ?? ????? traditionally ??????? ? ??????. ????? ???? DST ???? ??? ????? ?????? 2 ? ??? ????? ?????? ?? ???? ? ???? ????? ?????? 2 ? ??? ????? ????? ?? ??????.

???? ?????? ?????? ????????? ??? ??????? ?????? ?? 2007.
?? ??? ??????????? ??? ??????
????? ????? DST ?????? ??????????? ??? ??? ????? ??????? ?????? ?? 2007????? ????? DST ?????? ?????????? ????? ????? ??????? ?????? ?? 2007
??? ????? ????? ?? ??? ????? ?? ????????? ????? ?????? ?? ??? ???? ?? ????????? ????? ?????? ?? ??? ?????? ?? ?????? ??? ????? ????? ?? ??? ??????
?? ?? 1 ????? ?????? ???? ?????? ?? 28 ?????? ????4 ?????? ????
?????? ??? ??????? ????? ????? Microsoft SQL Server 2005 ? Microsoft SQL Server 2000 ????????? ??? ??????? ?????? ?? 2007.

??????? ????

????????? ???? ??? ?? ????

??? ??? ???? SQL Server ??????? ??? ??????? ?? ?????? ?? ??? ?????? ????? ???????? DST ??????? ??????? ????????? ???? ????????? ??? ??????? ?????? ?? 2007 ??? ????? ????????? ???????:
  • ?? ?????? ??????? ?? Windows ?????? ?? ????? "????? ??????? ?? Microsoft" 924840. ????? ?? ?????????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
    924840????? ????? ?????? ?? ????? ??????? ??????? 2007 ??????? ?? Windows
  • ??? ??? ???? ????? ??????? SQL Server ?????? ??? ???? ????????? ?????? ??????? ?????? ?? ????? "????? ??????? ?? Microsoft" 931815. ????? ?? ?????????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
    931815??????? ????? ????? 2007 ?? SQL Server 2005 ????? Services ????? ??????? ????? ?? SQL Server 2000
  • ?? ???? ????? ????? ??? ??????? ????? ?? SQL Server ?????? ?? ?? SQL Server ???? ???? ????. ??? ???? ??? ???? ????? ???? ???????. ???????? ??? ???? ??? ????? ?????? ?????????? ???? ?????? ?? SQL Server. ??? ???????? ???????? ?? ????? "????? ????? Windows SharePoint Services?" Microsoft CRM ?????. ?????? ??? ????? ????? ?? ????????? ???? ??? ????? ??????? Microsoft ?????? ?? ?????? ???? Microsoft ?????? ??? ?????:
    http://support.microsoft.com/gp/cp_dst

??????? ????? SQL Server ?????? ????????

?? SQL Server 2005 ??? SQL Server 2000 ?????? ???? ????? ?????? SQL Server ??????? ??????? ?? ???? ??? ????? ?????? ??????? ?????:
  • ???? ??? ??? ???? ?????
  • ???? ??? ????? ??? ????? ????????
?? ??? ??? ???? ????? ??? ???? ????? ????????? ???? ?????? ?????? ??????? (RDTSC) ?? CPU. ?? ?????? ??? ????? ???????? ??? ???? ????? ?????? GetTickCount ?? Microsoft Windows API.

??? ???? ?? ??????? ???????? ??? ???? ??????? ?????? ?????? ????? ??? ??? ????? ??? ????? ????? ??? ???? ??????. ??? ??? ????? ??? ??? ?????? ??? ???????? ???? ?? ??? ???? ???????? ???????? ???????? ???????? ?? ????? ??????? ??????? ?????? ?? 2007.

??? ???? ??????? ????? ?????? ???? ????? ??????? ???????? ??? ???? ??? ????? ??????? ?? ???????? ???????? ??? ???? ??? ?????:
  • ?????? ?????? ??? ?????? ??????? ???? ????? ????? ????? ?????
  • ???? ?? ??????? ??? ????? ????? ??????? ??????
  • ????? ??? ????? Time ??????? ??? ?????? ???????, latches
  • ????? ???????? ??? SQL Server ???? ???? ?????? ???????
  • ?????? ?????? ??? ????? WAITFOR
???? SQL Server ????? ?????? ??????? ????? ???? ?? ??????? ??????? ??????? ????????. ??? ??????? ??? ????????? ??? ?? ???? ????? Windows. ????? ???? ??????? ??? ???? ????? ?? ???? ??????? ?????? ???? ????? ??????.

??? ???? ??????? ????? ?????? ???? ????? ???????? ??????? ???????? ????????:
  • ????? ????? ???? ????? ??????? SQL Server ?? SQL ???? ????? ??????? ??? ???? ???? ????? ???????? ??? ???????? ?????? ????? ??????? ????????
  • ??????? ????? ???? ??? ????? ?? ????? ?????? ??? SQL Server Errorlog ????? ??????? ?????? ??????
  • ????? ?????? ??? ?????? GetDate ??????? GetUtcDate
???? ??? ????????? ??????. ????? ???? SQL Server ???????? ???? ????? ??????? SQL Server ?? SQL ???? ????? ???????. ????? ?????? ?????? ??????? ???? ??? ??? ???? ???? DST ?? ????? ??? ????? ????? ???? ???? DST. ?? ??? ?????????? ??????? ??? ???? ?? ?? ????? ??????? ??????? ??????.
???? ?????? ????? ????? ??????:
EventSequence  EventClass         TextData              StartTime                EndTime                  Duration
156            Sql:StmtStarting   Select * From Table1  2007-03-11 01:59:57.187
157            Sql:StmtCompleted  Select * From Table1  2007-03-11 01:59:57.187  2007-03-11 03:00:07.187  9987
?????? ??????? ?? ????? ??????? ???? ??????? ??????? ????? ????? ????? ?????? ???? DST:
EventSequence  EventClass         TextData              StartTime                EndTime                  Duration
178            Sql:StmtStarting   Select * From Table1  2007-11-04 01:59:54.967
179            Sql:StmtCompleted  Select * From Table1  2007-11-04 01:59:54.967  2007-11-04 01:00:05.030  10055

????? ?????? ???? SQL DST ??? ????? ???? ??? ????? ??????? ??????? ?????? ?? 2007

????? ????? ???????? DateDiff ? DateAdd ??? ??? ??????? ??????

??? ??????? ?????? SQL ???????? ?????? ?????? ?????? ????? ???? ????? ??? ????? ?????? ???? ???????? ????? ??? ?? ????? ?????? ?? ????????. ???? ???? ??? ??? ????? ???? ??????? ?????? ?? ??? ????? ?????? ?? ???? ??????? ? ????? ?????? DateDiff ? DateAdd ??? ??? DST.

??? ???? ??????? ????? ????? ???????? ??????? ????? ????? ?????. ????? ?????? ??? ??? DST ??????. ???? ?? ??? ???? DST ?????? ?? 2007, 11 ???? 2007 ?? ????? ??? ??????? ??????. ??? ???? ??? ???? DST ?????? 01 ????? 2007 ?? ???? ????? ????? DST.
DECLARE @starttime datetime
DECLARE @endtime datetime
SELECT @starttime = GetDate() -- returns '2007-03-11 1:59:50.000'
WAITFOR DELAY '00:00:30'
SELECT @endtime = GetDate()   ?- returns '2007-03-11 3:00:20.000' 

If @starttime < '2007-04-01 3:00:00.000' And 
   @endtime > '2007-04-01 1:59:59.000'
	SELECT (cast((DATEDIFF(s, @starttime, @endtime)) as int) - 3600) AS TimeDiffInSecs
Else
	SELECT cast((DATEDIFF(s, @starttime, @endtime)) as int) AS TimeDiffInSecs

Go
??? ????? ?? ???????? ???? ??????? ???????:
TimeDiffInSecs 
-------------- 
3,630
??? ?????? ?????? DateDiff ??? DST ???, ???????? ?????? ??????? 3,630 ????? ?? 30 ?????.

?????? ?????? ????? ?? ????? ????????? ???, ?????? ?????? GetUtcDate ????? ?? ?????? GetDate. ???? ?????? GetUtcDate ??? UTC ??????. ???? ?????? ??? UTC ?????? ?? ??????? ?????? ?????? ?? ????? ??????? ??????? ?? ???? ????? ???? ????????? ???? ???? ?????? SQL Server ????.

The following are modified statements that work correctly:
/*-------------------------------------------------------
	  GetDate()		  GetUtcDate()
datetime  2007-03-11 1:59:50.000  2007-03-11 09:59:50.000
datetime  2007-03-11 3:00:20.000  2007-03-11 10:00:20.000
-------------------------------------------------------*/
DECLARE @starttime datetime
DECLARE @endtime datetime
SELECT @starttime = GetUtcDate() -- returns '2007-03-11 9:59:50.000'
WAITFOR DELAY '00:00:30'
SELECT @endtime = GetUtcDate()   ?- returns '2007-03-11 10:00:20.000'  
SELECT DATEDIFF (s, @starttime, @endtime) AS TimeDiffInSecs
Go
When you run the statements, you receive the correct result as follows:
TimeDiffInSecs 
-------------- 
30

????? ????? ?????? ??????? ?????? ??? ?????? ???????? ???? ???? SQL

???? ??? ????????? ??????. ???? ???? ?????? ?? SQL Server ???? ????? ??????? ?????? ??????. ???? ?????? ?? 15 ?????. ??? ???? ????? ??????? ?????? ?? ?????? ???? SQL Server ???? ????? ????? ??????? ?????? ????????. ???? ???? SQL ???? ?????? ????? ?? ??? ???? ??????? ????? ?????? ??????? ??????? ?????? ?????? ???? ????.

The following is the sample output of the job:
Job 'Daylight Savings Job 1' : Step 1, 'step 1' : Began Executing 2007-03-11 01:30:00
CurrentTime    2007-03-11 01:30:00.343

Job 'Daylight Savings Job 1' : Step 1, 'step 1' : Began Executing 2007-03-11 01:45:00
CurrentTime    2007-03-11 01:45:00.343

Job 'Daylight Savings Job 1' : Step 1, 'step 1' : Began Executing 2007-03-11 03:00:00
CurrentTime    2007-03-11 03:00:00.357

Job 'Daylight Savings Job 1' : Step 1, 'step 1' : Began Executing 2007-03-11 03:15:00
CurrentTime    2007-03-11 03:15:00.357
In this example, there is a one-hour gap between the run of the job at 2007-03-11 02:00:00 and the run of the job at 2007-03-11 03:00:00 as expected.

??? ???? ???? ????? ?????? ??? ?? ???? ????? ?????? ???????? ?? SQL Server ???? ???? ???? ????? ????? ???? ??? ???? ????? ?????? ???? DST. ??? ????? ?????? ??? ???? ?? 2: 00 ? ??? 1: 00 ? ?? 4 ?????? ???? ???? ???? ?????? ???? ???? ???? SQL ?? ????? ??? ????? 2: 00 ? ???? ??????. ??? ????? ??????. ???? ??? ??????? ??? ??? ???????? DST 2007 ??? ????? ????. ??? ??????? ??? ???? ?? ????????? ??? ??????? ?????? 2007.

The following is the sample output of the job:
Job 'Daylight Savings Job 1' : Step 1, 'step 1' : Began Executing 2007-11-04 01:30:00
CurrentTime    2007-11-04 01:30:00.343

Job 'Daylight Savings Job 1' : Step 1, 'step 1' : Began Executing 2007-11-04 01:45:00
CurrentTime    2007-11-04  01:45:00.343

one hour plus 15 minutes gap here */

Job 'Daylight Savings Job 1' : Step 1, 'step 1' : Began Executing 2007-11-04 02:00:00
CurrentTime    2007-11-04 02:00:00.357

Job 'Daylight Savings Job 1' : Step 1, 'step 1' : Began Executing 2007-11-04 02:15:00
CurrentTime    2007-11-04 02:15:00.357
Notice that in the sample output of the job, there is a one-hour-and-15-minute gap between the run of the job at 2007-11-04 01:45:00 and the run of the job at 2007-11-04 02:00:00. ?? ???? ??? ?????? ??? ???? ???? ????? ???????? "?" ???? ????? ????????? "?" ???? ????? ??? "?" ???? ?????? ???????? ?? SQL Server.

???????

???? ???????: 931975 - ????? ??? ??????: 10/?? ??????/1428 - ??????: 3.5
????? ???
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Standard X64 Edition
  • Microsoft SQL Server 2005 Standard Edition for Itanium Based Systems
  • Microsoft SQL Server 2005 Enterprise X64 Edition
  • Microsoft SQL Server 2005 Enterprise Edition for Itanium Based Systems
  • Microsoft SQL Server 2005 Workgroup Edition
  • Microsoft SQL Server 2005 Express Edition
  • Microsoft SQL Server 2000 Standard Edition
  • Microsoft SQL Server 2000 Workgroup Edition
  • Microsoft SQL Server 2000 Developer Edition
  • Microsoft SQL Server 2000 Enterprise Edition
  • Microsoft SQL Server 2000 Personal Edition
  • Microsoft SQL Server 2000 Enterprise Edition 64-bit
????? ??????: 
kbmt kbhowto kbexpertiseadvanced kbsql2005engine kbinfo KB931975 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????931975

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com