SQL Flow Field Guide

FOR SYSTEM_TIME FROM ... TO

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

FOR SYSTEM_TIME FROM..TO: rows active in the half-open period

What changes

Input
temporal table current + history
Output or change
rows matching the period rule

Syntax at a glance

table FOR SYSTEM_TIME FROM <start_date_time> TO <end_date_time>

Work example

An audit query needs FOR SYSTEM_TIME FROM ... TO to answer a time-bounded question about a temporal table.

Use explicit UTC timestamps and test both ends of the interval. Confirm the table is system-versioned before relying on history.

Check your work FOR SYSTEM_TIME FROM ... TO. The rows from FOR SYSTEM_TIME FROM ... TO match the requested time boundary and current rows are not confused with history rows.

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