Netherlands: Software

Introductie van Micorosoft SQL Server 2016

Issue link: http://hub-nl.insight.com/i/692679

Contents of this Issue

Navigation

Page 77 of 212

65 C H A P T E R 5 | Broader data access [ModifiedDate] [datetime] NOT NULL, CONSTRAINT [PK_ProductInventory_Temporal_Auto_ProductID_LocationID] PRIMARY KEY CLUSTERED ( [ProductID] ASC, [LocationID] ASC ), ValidFrom datetime2(7) GENERATED ALWAYS AS ROW START NOT NULL, ValidTo datetime2(7) GENERATED ALWAYS AS ROW END NOT NULL, PERIOD FOR SYSTEM_TIME (ValidFrom, ValidTo) ) WITH (SYSTEM_VERSIONING = ON); Note When you create a temporal table with an anonymous history table, you must have the CREATE TABLE permission in the database and ALTER PERMISSION on the schema for the new current and history tables. When you execute the CREATE TABLE statement, the database engine creates the temporal table as you defined it. It also creates the history table as a rowstore table with page compression if possible and names it MSSQL_TemporalHistoryFor__[suffix]. The suffix appears in the name only if the first part of the table name is not unique. The database engine also adds a clustered index named IX_ that contains the period columns. You can view the temporal table and its history table in Object Explorer in SQL Server Management Studio (SSMS), as shown in Figure 5-1. You can identify a temporal table by the System-Versioned label that is appended to the temporal table name. The History label is appended to the history table. The tables are identical, except that the history table does not include a primary key. Figure 5-1: A temporal table and its history table displayed together in SSMS's Object Explorer.

Articles in this issue

Archives of this issue

view archives of Netherlands: Software - Introductie van Micorosoft SQL Server 2016