January 30, 2009 at 4:27 pm
well, SQL servers datetime datatype is only accurate to 3 milliseconds increments...so if you try to increment by milliseconds it goes from 0,3,6,9 all the way up to 997
to preserve the accuracy of your data, i would save your real data as a varchar, and add a calculated field of type datetime based on the convert of the varchar.
Lowell
February 2, 2009 at 10:10 am
Thanks for the reply. I figured that was why the rounding was occuring, but that is incorrect. .198 rounded up is not .1100.
I'll take a look at your idea though and see if that is feasible to do.
Thanks again!
February 2, 2009 at 1:01 pm
SQL 2008 supports 100 nanosecond time resolution!
* Noel
February 2, 2009 at 1:06 pm
Yes that is the same with .NET DateTime but it require Double data type because INT resolution is limited.
So you can either use time in SQL Server or use .NET you could get millisecond very easily because .NET DateTime can get you ticks so you just need your DateTime defined as Double to get milliseconds and add it to SQL Server Nvachar column. The reason you are not getting the correct value could be SQL Server DateTime may be using INT for DateTime Data Type which does not come with the resolution needed to generate millisecond easily.
Kind regards,
Gift Peddie
Viewing 4 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply