Skip to Main Content
SQL Server 2017 Developer???s Guide
book

SQL Server 2017 Developer???s Guide

by Dejan Sarka, Miloš Radivojević, William Durkin
March 2018
Intermediate to advanced content levelIntermediate to advanced
816 pages
19h 35m
English
Packt Publishing
Content preview from SQL Server 2017 Developer???s Guide

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SQL Server 2016 Developer's Guide

SQL Server 2016 Developer's Guide

Miloš Radivojević, Dejan Sarka, William Durkin
Mastering SQL Server 2017

Mastering SQL Server 2017

Milos Radivojevic, Dejan Sarka, William Durkin, Christian Cote, Matija Lah

Publisher Resources

ISBN: 9781788476195Supplemental Content