SQL Server change tracking
(Created page with "Tracking of changes is available from Sql Server 2008 and in Azure SQL. It's available in the '''Express''' editions, so you can use it in the build in Turnkey database. To t...") |
No edit summary |
||
Line 8: | Line 8: | ||
====== More reading ====== | ====== More reading ====== | ||
https://docs.microsoft.com/en-us/sql/relational-databases/track-changes/about-change-tracking-sql-server | https://docs.microsoft.com/en-us/sql/relational-databases/track-changes/about-change-tracking-sql-server | ||
====== See also when implementing ====== | |||
https://docs.microsoft.com/en-us/sql/relational-databases/track-changes/work-with-change-tracking-sql-server | |||
Setting Context Information provides a way to know that the MDrivenServer is the source of the change | |||
Maybe '''last_synchronization_version''' can be used to know if ANY change has occured | |||
-- Check all tables with change tracking enabled | |||
IF EXISTS ( | |||
SELECT COUNT(*) FROM sys.change_tracking_tables | |||
WHERE min_valid_version > @last_synchronization_version ) | |||
BEGIN | |||
-- Handle invalid version & do not enumerate changes | |||
-- Client must be reinitialized | |||
END |
Revision as of 13:48, 12 April 2018
Tracking of changes is available from Sql Server 2008 and in Azure SQL. It's available in the Express editions, so you can use it in the build in Turnkey database.
To turn change tracking On, do like this
ALTER DATABASE AdventureWorks2012 SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 2 DAYS, AUTO_CLEANUP = ON)
More reading
See also when implementing
Setting Context Information provides a way to know that the MDrivenServer is the source of the change
Maybe last_synchronization_version can be used to know if ANY change has occured
-- Check all tables with change tracking enabled IF EXISTS ( SELECT COUNT(*) FROM sys.change_tracking_tables WHERE min_valid_version > @last_synchronization_version ) BEGIN -- Handle invalid version & do not enumerate changes -- Client must be reinitialized END
This page was edited more than 9 months ago on 03/26/2024. What links here