Skip to content

Instantly share code, notes, and snippets.

@jcorderodr
Created July 28, 2017 00:40
Show Gist options
  • Select an option

  • Save jcorderodr/eb4d47a9203dc71e8fe8a9ce48a6a86b to your computer and use it in GitHub Desktop.

Select an option

Save jcorderodr/eb4d47a9203dc71e8fe8a9ce48a6a86b to your computer and use it in GitHub Desktop.
MSSQL - Change Tracking Scripts
-- To know wich tables are Tracking enable
SELECT sys.schemas.name as Schema_name, sys.tables.name as Table_name FROM sys.change_tracking_tables
JOIN sys.tables on sys.tables.object_id = sys.change_tracking_tables.object_id
JOIN sys.schemas on sys.schemas.schema_id = sys.tables.schema_id
--Enable Tracking on 'abc' table
ALTER TABLE dbo.abc ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = OFF)
-- More info: https://msdn.microsoft.com/en-us/library/bb933875%28v=sql.105%29.aspx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment