Sqlserver 2008返回错误的日期 [英] Sqlserver 2008 returns the incorrect date

查看:93
本文介绍了Sqlserver 2008返回错误的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,





我在sqlserver 2008中使用下面的GetDate()更新语法:

更新tblSurvey

设置CloseDate = GetDate(),

其中SurveyId = @ SurveyGroupId。



而不是今天的日期,它在tblsurvey中将日期更新为2013-06-23 12:25:00.803。

下次,我执行了相同的查询。它有为我显示了正确的日期。



有什么想法为什么日期不正确?





问候,

priya。

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.

推荐答案

您是否100%确定该值不是测试结果或手动操作?



如果您要进一步调查问题需要重现它。



我的建议是创建一个带有 INT 列的表作为 IDENTITY 和一个日期列。



设置一个SQL代理作业每隔几秒运行一次。每隔几秒插入 GETDATE()。让它运行一两天,然后检查是否有任何日期不按顺序。



如果几天后没有日期不按顺序然后你可能不应该担心它会再次发生。



我们在操作系统级别有一个日期时间同步问题,其中一个请求损坏了一段时间同步服务器。我们几个月后又回来了,然后在下次检查时纠正了自己。



你是否在操作系统上使用时间同步服务器?
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?


这篇关于Sqlserver 2008返回错误的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆