• Hugo Kornelis (2/17/2009)


    Finally, the datetime datatype is not inexact. It is basically a counter of the number of 1/300 second intervals since a fixed starting point (midnight of Jan 1st, 1900), so in many regards it is equivalent to an integer.

    Just to clarify this, it is not actually a count of 1/300ths of a second ('ticks') since some epoch. It is an 8-byte field composed of two 4-byte integers.

    The first 4 bytes represent an integer, being the days after (or before - it's signed!) 01 Jan 1900.

    The second 4 bytes is the number of 1/300ths of a second ('ticks') that have passed since midnight (up to 25,920,000 of them)

    For collation purposes, they can be treated as a simple 8-byte integer, but be aware of the days-ticks split.

    Note that there neither timezone or daylight saving information stored

    (ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/9bd1cc5b-227b-4032-95d6-7581ddcc9924.htm)

    Also, IIRC, IBM mainframes (360 & 370 anyway) updated their TOD clock every 300th of a second, to a precision of better than a microsecond. That was an interesting example of the difference between precision and accuracy!