Sql ChangeTracking table cleaning

When using Sql 2008 Change Tracking, is there a way to manually clear the tracking tables?

I know about the CHANGE_RETENTION and AUTO_CLEANUP properties, but I get more control over the cleanup.

+7
source share
2 answers

Basically, this change tracking data is stored in internal tables and there is no way to manually clean it. But still, we can clear it by disabling / enabling change tracking for tables.

alter table <tableName> disable change_tracking alter table <tableName> enable change_tracking 

This command will clear all change tracking related to a particular table.

+6
source

If you want to disable change binding for all tables:

 EXEC sp_msforeachtable "ALTER TABLE ? DISABLE CHANGE_TRACKING" , @whereand=" and exists ( select null from sys.change_tracking_tables ctt where ctt.object_id = o.id ) " 
+1
source

All Articles