How a datetime is stored in SQL Server
Have you ever wondered how dates/times are stored in SQL Server? Probably not, but it’s still interesting to know. There are two date/time formats available in SQL Server: DATETIME and SMALLDATETIME.
DATETIME is stored as two 4-byte integers while SMALLDATETIME is stored as two 2-byte integers. Both integers represent offsets, one is the number of days from that historic day in January 1, 1990, the other is the number of units since midnight. Where the unit for DATETIME is a clocktick and a minute for SMALLDATETIME.
So does anyone else see a problem here? What will happen in January 1, 1990 + 2^15-1 days?