Configuring the retention policy at the database level

The temporal historical retention feature must be enabled at the database level. For new databases, this flag is enabled by default. For databases restored from previous database versions (as with the WideWorldImporters database used in this book), you need to set it manually. The following code enables the temporal historical retention feature for this database:

ALTER DATABASE WideWorldImporters SET TEMPORAL_HISTORY_RETENTION ON;

Now, you can define the retention policy at the (temporal) table level.

Get SQL Server 2017 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.