SQL Flow Field Guide

datetime2 (data type)

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

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 Flow
SELECT 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.