SQL Server Change Detection
Enable for Database:
ALTER DATABASE <Database Name> SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 2 DAYS, AUTO_CLEANUP = ON)
Disable for Database
ALTER DATABASE <Database Name> SET CHANGE_TRACKING = OFF
Enable for Each table:
ALTER TABLE <Table Name> ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = ON)
Disable for table
ALTER TABLE <Table Name> DISABLE CHANGE_TRACKING;
Create Enable Tracking for All Tables
select 'ALTER TABLE ' + name + ' ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = ON);' from sys.tables where type = 'U' -- USER_TABLE type
List All Indexes
Comments
Post a Comment