SQL Flow Field Guide

DATEDIFF_BIG

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

date/time arithmetic, parts, construction or truncation

What changes

Input
date/time arguments
Output or change
date/time or integer value
Return type
Signed bigint

Syntax at a glance

DATEDIFF_BIG ( datepart , startdate , enddate )

Work example

Measure datepart boundaries across a span that could overflow int.

Use DATEDIFF_BIG for fine-grained measurements over long intervals and retain the bigint result.

Check your work The result is a count of boundaries, not a duration with fractional units.

Practice SQL

Open in SQL Flow
SELECT DATEDIFF_BIG(second, CONVERT(datetime2, '2000-01-01'), CONVERT(datetime2, '2026-01-01')) AS seconds_between;

Open Microsoft Learn for full syntax, permissions, and details for your version.