SQL Flow Field Guide

ALTER TABLE ... SET (SYSTEM_VERSIONING)

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

toggles system-versioning

What changes

Input
table and history table definitions
Output or change
temporal link on or off

Syntax at a glance

ALTER TABLE table SET ( SYSTEM_VERSIONING = { OFF | ON [ ( HISTORY_TABLE = schema.table [ , DATA_CONSISTENCY_CHECK = { ON | OFF } ] ) ] } )

Work example

A temporal table needs a planned history-table or versioning state change.

Check active writers, history retention, period columns, consistency, and the gap in historical capture.

Check your work Versioning is restored and an AS OF query returns the expected lab history.

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