select getdate(),DATEADD(millisecond,1,getdate())
yields me same answer....How to add exactly 1 millisecond?
I cannot use a datetime2
field.
You can't. The accuracy of datetime
is 3.33 milliseconds.
Date and Time
The resolution of the DATETIME
type is insufficient for your needs; per the documentation, it is:
Rounded to increments of .000, .003, or .007 seconds
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With