is a new type of user table. It was introduced in
.
Temporal tables keep a full history of data changes (based on UTC time) by using a pair of current-historical tables. These tables has the same structure.
The period of validity for every row is managed by the system (i.e. Database Engine) by using two explicitly-defined columns of the DateTime2 datatype.
Below you can find an example of a user table's definition that has system versioning enabled:
This article was a simple example of using temporal tables in SQL Server 2016. I consider temporal tables one of the top new features in SQL Server 2016 as they have to offer significant functionality.
Some benefits of using temporal tables:
- Auditing all data changes (i.e. for data forensics)
- Data reconstruction/recovery
- Trends monitoring over time