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

Creating temporal tables

To support the creation of temporal tables, the CREATE TABLE and ALTER TABLE Transact-SQL statements have been extended. To create a temporal table, you need to perform the following steps:

  1. Define a column of DATETIME2 data type for holding the info since when the row has been valid from a system point of view
  1. Define a column of DATETIME2 data type for holding the info until the row is valid from the same point of view
  2. Define a period for system time by using previously defined and described columns
  3. Set the newly added SYSTEM_VERSIONING table attribute to ON

The following code creates a new temporal table named Product in the dbo schema in the WideWorldImporters database:

USE WideWorldImporters; CREATE TABLE dbo.Product ...
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