Wednesday, November 29, 2017

What is the difference between smalldatetime and datetime?



DateTime SmallDateTime
Storage Size 8 Bytes 4 Bytes
FORMAT YYYY-MM-DD hh:mm:ss.nnn YYYY-MM-DD hh:mm:ss
MIN Value 1753-01-01 00:00:00 1900-01-01 00:00:00
MAX Value 9999-12-31 23:59:59.997 2079-06-06 23:59:00
Accuracy Rounded to increments of .000, .003, or .007 second
It means:
If time part in the date is 23:59:58.990 or 23:59:58.991, it will be stored as 23:59:58.990.
1 Minute
Second’s values that are 29.998 seconds or less are rounded down to the nearest minute. And second’s values of 29.999 seconds or more are rounded up to the nearest minute. So seconds part value is always 00.

No comments: