強烈建議您將 SYSTEM_VERSIONING 設為DATA_CONSISTENCY_CHECK = ON,以針對現有資料強制執行資料一致性檢查。如果慣用隱藏的資料行,請使用命令 ALTER TABLE [tableName] ALTER COLUMN [columnName] ADD HIDDEN;。相關內容暫存資料表 開始使用系統版本設定時態表 管理系統設定版本時態表中的歷程記錄資料保留 系統版本...
CREATE TABLE dbo.WebsiteUserInfo ( UserID INT NOT NULL PRIMARY KEY CLUSTERED, UserName NVARCHAR(100) NOT NULL, PagesVisited int NOT NULL, ValidFrom DATETIME2(0) GENERATED ALWAYS AS ROW START, ValidTo DATETIME2(0) GENERATED ALWAYS AS ROW END, P...
仅当 ColumnX 被索引键覆盖时,才能获取键范围锁。 示例 以下表和索引用作随后的键范围锁定示例的基础。 范围扫描查询 为了确保范围扫描查询是可序列化的,每次在同一事务中执行的相同查询应返回同样的结果。 其他事务不能在范围扫描查询中插入新行;否则这些插入将成为虚拟插入。 例如,以下查询将使用上图中...
'9999-12-31 23:59:59.9999999')GOSELECT*FROMdbo.TemporalTableTEST4GO--UPDATE dbo.TemporalTableTEST4 SET SysEndTime = '9999-12-31 23:59:59.9999999'--GO--ALTER TABLE dbo.TemporalTableTEST4--ALTER COLUMN SysStartTime DATETIME2 GENERATED ALWAYS AS ROW START--ALTER TABLE dbo.TemporalTableTEST4...
{ CHECK | NOCHECK } ] | ADD { <column_definition> | <computed_column_definition> | <table_constraint> | <column_set_definition> } [ ,...n ] | [ system_start_time_column_name datetime2 GENERATED ALWAYS AS ROW START [ HIDDEN ] [ NOT NULL ] [ CONSTRAINT constraint_name ] DEFAULT ...
If you need to perform data audit in existing databases, use ALTER TABLE to extend non-temporal tables to become system-versioned. In order to avoid breaking changes in your application, add period columns as HIDDEN, as explained in Create a system-versioned temporal table....
{ CHECK | NOCHECK } ] | ADD { <column_definition> | <computed_column_definition> | <table_constraint> | <column_set_definition> } [ ,...n ] | [ system_start_time_column_name datetime2 GENERATED ALWAYS AS ROW START [ HIDDEN ] [ NOT NULL ] [ CONSTRAINT constraint_name ] DEFAULT ...
{ CHECK | NOCHECK } ] | ADD { <column_definition> | <computed_column_definition> | <table_constraint> | <column_set_definition> } [ ,...n ] | [ system_start_time_column_name datetime2 GENERATED ALWAYS AS ROW START [ HIDDEN ] [ NOT NULL ] [ CONSTRAINT constraint_name ] DEFAULT ...
The history table must always be schema-aligned with the current or temporal table, with respect to the number of columns, column names, ordering and data types. An anonymous history table is automatically created in the same schema as current or temporal table. ...
publicoverrideSystem.Data.DataTableGetSchema(stringcollectionName,string[] restrictionValues); Parameters collectionName String Specifies the name of the schema to return. restrictionValues String[] A set of restriction values for the requested schema. ...