datetime2 (data type)
data type datetime2
What changes
- Input
- none
- Output or change
- none
Syntax at a glance
datetime2 [ ( fractional seconds precision ) ]
Work example
Store a high-precision date and time when the offset is handled by the application contract.
Choose the fractional scale needed by the source and document whether values are UTC.
Check your work datetime2 stores no time-zone offset, even when the application supplies UTC values.
Practice SQL
Open in SQL FlowSELECT CAST('2026-04-05T12:30:15.1234567' AS datetime2(7)) AS event_time;
Open Microsoft Learn for full syntax, permissions, and details for your version.