• jim.taylor (11/30/2009)


    I'm confused, if DateTime is only precise to 3.33 ms, why then is the answer just 1 ms off? Why not 3 ms?

    SQL Server rounded down to 100 ms from the 101ms that was added.

    if you add 102ms it rounds up to 103 ms.

    I posted this question because the inaccuracy caught me off guard a couple months ago when I kept getting unexpected results out of some code.

    After suspecting sheer lunacy to be the root cause, I finally got the notion that maybe the SQL Server clock was dodgy. I wrote the query that you see in the question to test that theory and the BOL confirmed the rest.

    To avoid the issue, use datetime2 which is more precise, but still has the same problem when you get down to 100 nanoseconds.

    My issue was resolved by ignoring milliseconds since I didn't need to be that precise, and accuracy was more important than precision.

    Thanks All!

    ~Craig