datetime2
is a data type that is able to store a date-time value with a maximum accuracy of 100 nano seconds. Thus, it extends the data type datetime
which is less accurate. 0001-01-01 00:00:00.0000000
to 9999-31-12 23:59:59.9999999
. sysdatetime()
returns the current date and time as as datetime2(7)
.