如何精确添加 1 毫秒? [英] How can I add exactly 1 millisecond?

查看:31
本文介绍了如何精确添加 1 毫秒?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

select getdate(),DATEADD(millisecond,1,getdate())

给我同样的答案....如何精确添加 1 毫秒?

yields me same answer....How to add exactly 1 millisecond?

我不能使用 datetime2 字段.

推荐答案

如果您需要如此高的准确性,则需要单独存储毫秒.在 SQL Server 2005 中,没有本机日期/时间类型可以让您比 ~3 毫秒更精确.这就是为什么,例如,您一天中的最后一次是 23:59:59.997,而不是 0.998 或 0.999.

You'll need to store milliseconds separately if you need that much accuracy. In SQL Server 2005 there is no native date/time type that will allow you to be more precise than ~3 ms. This is why, for example, the last time you can have in a day is 23:59:59.997, not .998 or .999.

这篇关于如何精确添加 1 毫秒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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