From the course: Microsoft SQL Server 2016 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Temporal tables

Temporal tables - SQL Server Tutorial

From the course: Microsoft SQL Server 2016 Essential Training

Start my 1-month free trial

Temporal tables

- [Instructor] In this section we're going to talk about temporal tables, and temporal tables are new in SQL Server 2016. They are tables that automatically maintain a history of all of the changes that occurred in the table, and we can very easily query that history and see what the table would've looked like at some point in the past. I've staged some code for you in your exercise files. I'm going to copy the top half of the code to a new query window, and before we run it let's look at it. I'm creating a new table called Inventory. It'll have a primary key column called InventoryID, and an ItemName column, and those are the typical columns I would have in an inventory table. Then I have three more columns I need to add because this is a temporal table, and typically for any other temporal table you'll create, you'll need these exact three columns with these exact names and these exact datatypes. There's a column called ValidFrom. It's datatype is datetime2, and we have to put the…

Contents