Configuring the retention policy at the table level

To configure the retention policy, you need to specify a value for the HISTORY_RETENTION_PERIOD parameter during table creation or after the table is created. Use the following code to create and populate a sample temporal table:

USE WideWorldImporters;GOCREATE TABLE dbo.T1(    Id INT NOT NULL PRIMARY KEY CLUSTERED,    C1 INT,    Vf DATETIME2 NOT NULL,    Vt DATETIME2 NOT NULL ) GOCREATE TABLE dbo.T1_Hist(    Id INT NOT NULL,    C1 INT,    Vf DATETIME2 NOT NULL,    Vt DATETIME2 NOT NULL ) GO--populate tablesINSERT INTO dbo.T1_Hist(Id, C1, Vf, Vt) VALUES(1,1,'20171201','20171210'),(1,2,'20171210','20171215');GOINSERT INTO dbo.T1(Id, C1, Vf, Vt) VALUES(1,3,'20171215','99991231 23:59:59.9999999');GO

Here is the content ...

Get Mastering SQL Server 2017 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.