gpt4 book ai didi

sql - 申报日期与选定日期不匹配

转载 作者:行者123 更新时间:2023-12-02 06:15:49 25 4
gpt4 key购买 nike

我声明了一个名为 @dt 的日期时间变量 -

declare @dt Datetime = '2019-01-29 11:06:31.095'

当我选择变量时,它给出了错误的日期

select @dt --it gives '2019-01-29 11:06:31.097'

最佳答案

根据manual :

datetime values are rounded to increments of .000, .003, or .007 seconds, as shown in the following table.

所提供链接中的表格清楚地说明了您的值从 '.095' 转换为 '.097' 的原因:

User-specified value    System stored value
-----------------------------------------------
01/01/98 23:59:59.999 1998-01-02 00:00:00.000
01/01/98 23:59:59.995

01/01/98 23:59:59.996

01/01/98 23:59:59.997

01/01/98 23:59:59.998 1998-01-01 23:59:59.997

关于sql - 申报日期与选定日期不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54434855/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com