Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,


I am using the GetDate() in the following below update Syntax in the sqlserver 2008:
Update tblSurvey
Set CloseDate=GetDate(),
Where SurveyId=@SurveyGroupId .

Instead of today's date,It has updated the date as "2013-06-23 12:25:00.803" in the tblsurvey.
Next time,I have executed the same query.It has shown the correct date for me.

Any thoughts Why it has shown incorrect date ?


Regards,
priya.
Posted
Comments
ZurdoDev 17-Jun-13 17:02pm    
Because the clock on the system was wrong.
CHill60 17-Jun-13 17:12pm    
Not a silly answer. GetDate() returns the system date ... check the date on the server that is hosting your sql server instance
CHill60 17-Jun-13 17:13pm    
P.S. If you don't use the Reply link next to a comment, then the poster will not know that you've responded
priya9826 17-Jun-13 17:23pm    
Hi,

Okay..But This returns the incorrect date only one time.I have executed the same query once again,it shows the correct date.Is that means some one has change the date on the server with in seconds?

1 solution

Are you 100% sure the value wasn't the result of testing or manual manipulation?

If you're going to further investigate the problem you need to reproduce it.

My advice would be to create a table with an INT column as an IDENTITY and a date column.

Set up an SQL agent job to run every couple of seconds. Insert GETDATE() every couple of seconds. Let it run for a day or two and then check if any of the dates are out of sequence.

If after a couple of days you have no dates out of sequence then you probably shouldn't be worried at it reoccurring.

We have had date time sync issues at the OS level where there was a corruption in a request to a time sync server. We jumped back in time several months and then it corrected its self on the next check.

Are you using a time sync server for the OS?
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900