sql server historical table

Solutions on MaxInterview for sql server historical table by the best coders in the world

showing results for - "sql server historical table"
Clifton
08 Apr 2019
1CREATE TABLE Department
2(
3    DeptID INT NOT NULL PRIMARY KEY CLUSTERED
4  , DeptName VARCHAR(50) NOT NULL
5  , ManagerID INT NULL
6  , ParentDeptID INT NULL
7  , SysStartTime DATETIME2 GENERATED ALWAYS AS ROW START NOT NULL
8  , SysEndTime DATETIME2 GENERATED ALWAYS AS ROW END NOT NULL
9  , PERIOD FOR SYSTEM_TIME (SysStartTime, SysEndTime)
10)
11WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.DepartmentHistory));
12