Skip to main content

Posts

Showing posts from December, 2018

Temporal tables of SQL Server 2016 not temporary

Temporal table is an add on to SQL Server 2016 which allows history maintaining. In simple terms it allows us to have a system versioning. For an example if we have a person's salary as 1000 usd as per today and tomorrow if it is updated as 1005 usd in such scenario the temporal table maintains two tables namely the generic one and a history table where the present record will be stored in the normal table and the previous one will be stored in the history table. Let’s dig in deeper that with an example, First off I will create a employee temporal table with system versioning enabled. In this case even though we are creating a single table it creates two identical tables with one having a history part concatenated to it's name. ***Note : For easier identification the queries are given in italic. CREATE TABLE [master] . dbo . Employee    (       [EmployeeID] int NOT NULL PRIMARY KEY CLUSTERED      , [Name] nvarchar ( 100 ) NOT NULL     , [Positio