For more information about how to analyze smalldatetime and datetime in SQL, see.
For more information about how to analyze smalldatetime and datetime in SQL, see.
1: Date range
The valid time range of smalldatetime is ~ 2079/6/6
The valid time range of datetime is 1753/1/1 ~ 9999/12/31
2: Accuracy
Smalldatetime is accurate to the minute, while datetime is accurate to 3-bit milliseconds.
3: storage space
Smalldatetime occupies four bytes, and the first two bytes store the number of days after base date (January 1, January 1, 1900. The last two bytes are stored in minutes after midnight.
Datetime occupies 8 bytes. The first 4 bytes store the number of days before or after base date (January 1, 1900), and the last 4 bytes store the number of milliseconds after midnight.
Example |
Adjusted example |
01/01/98 23:59:59. 999 |
00:00:00. 000 |
01/01/98 23:59:59. 995, 01/01/98 23:59:59. 996, 01/01/98 23:59:59. 997, or 01/01/98 23:59:59. 998 |
23:59:59. 997 |
01/01/98 23:59:59. 992, 01/01/98 23:59:59. 993, 01/01/98 23:59:59. 994 |
23:59:59. 993 |
01/01/98 23:59:59. 990 or 01/01/98 23:59:59. 991 |
23:59:59. 990 |