On Transact SQL language the datetime2 is part of date and time data types and is an extension of the datetime type that has a larger date range, a larger default fractional precision.
Datetime2 syntax:
datetime2
| Property | Value |
|---|---|
| Default string literal format | YYYY-MM-DD hh:mm:ss[.fractional seconds] |
| Range | 0001-01-01 through 9999-12-31 |
| Length | 19 minimum - 27 maximum |
| Storage size | 8 bytes |
| Calendar | Gregorian |
Datetime2 example:
USE model;
GO
DECLARE @datetime2 datetime2 = '08-21-14 10:09:30.123';
SELECT @datetime2 AS 'Datetime2';
GO
| Datetime2 |
|---|
| 2014-08-21 10:09:30.1230000 |