[thelist] SQL Chaos!!

rudy r937 at interlog.com
Tue Jan 28 12:40:26 CST 2003


> If you're using MS SQL Server you can take advantage of the fact that
> datetime values are stored as floats, with the fractional part
representing
> the time of day.

actually, datetime values are stored as two 4-byte integers

the first integer, either positive or negative, is the number of days before
or after the base date january 1 1900, with values earlier than january 1
1753 not permitted

the second integer is the time of day represented as the number of
milliseconds after midnight

smalldatetime values are only 2-byte integers, allowing dates only between
january 1 1900 and june 6 2079, and times only to the minute

http://msdn.microsoft.com/library/en-us/tsqlref/ts_da-db_9xut.asp


but yes, if you just want to sort, casting as integer works nicely

rudy




More information about the thelist mailing list