Updating tables with foreign key constraints

Rated 3.92/5 based on 779 customer reviews

Also we can observe that even though we have written our queries as SELECT *, still it did not return the period columns Start Time and End Time of the Temporal Table as these columns are marked as HIDDEN.

If we need to get these columns in the result we need to specify them explicitly in the SELECT statement as in the following statement.

Customer’ because it is not supported operation on system-versioned tables.

--Create demo data base CREATE DATABASE Sqlhints Temporal Demo DB GO USE Sqlhints Temporal Demo DB GO --Create Temporal Table dbo. Customer ( Id INT NOT NULL PRIMARY KEY CLUSTERED, Name NVARCHAR(100) NOT NULL, Start Time DATETIME2 GENERATED ALWAYS AS ROW START HIDDEN NOT NULL, End Time DATETIME2 GENERATED ALWAYS AS ROW END HIDDEN NOT NULL , PERIOD FOR SYSTEM_TIME (Start Time, End Time) ) WITH(SYSTEM_VERSIONING=ON (HISTORY_TABLE=dbo.Let us execute the following statement to insert a record in the Temporal Table dbo.Customer by enabling the actual execution plan: RESULT The above statement worked even though we have not specified Start Time and End Time column values.Because of the tracking of the fully history of the data, it provides a mechanism to know the state of the data at any point in time.With regular tables we can only know the current/latest state of the data, we will not be able to see the past state of the updated or deleted records.

Leave a Reply