Tutorial: System-Versioned tables

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance

system-versioned tables, also known as temporal tables, can also be configured directly on Azure Data Studio. If you're new to system versioning, check out the temporal tables on SQL Server documentation. system-versioning tables must have the period columns defined.

Creating a system-versioned table

  1. Create a table called "Department" with the column properties as seen below. To do this, right-click on the Tables folder in the Connections pane and select "New Table". Next, in the Table Properties pane, select the "System Versioning Enabled" check box. You can decide to rename this history table or leave the default name as is.

    Screenshot of Table Designer showing how to create a system-versioned-table.

  2. The period columns, ValidFrom and ValidTo are enabled by default on system-versioned tables. The script pane will now be updated to show the T-SQL version of this system-versioned table.

    Screenshot of Table Designer showing how to define period columns.

Note

system-versioned tables require a primary key.

Next step