CREATE TABLE ... WITH (SYSTEM_VERSIONING = ON)
turns on system-versioning: every UPDATE/DELETE copies the old row version to history
What changes
- Input
- table definition
- Output or change
- temporal table plus a linked history table
Syntax at a glance
WITH ( SYSTEM_VERSIONING = ON [ ( HISTORY_TABLE = schema_name.history_table_name [ , DATA_CONSISTENCY_CHECK = { ON | OFF } ] ) ] )
Work example
A temporal table needs automatic history rows for updates and deletes.
Review history table ownership, retention, consistency checks, and storage growth before enabling versioning.
Check your work A lab update creates the prior row in history and an AS OF query returns it.
Open Microsoft Learn for full syntax, permissions, and details for your version.