摘要:获得启用跟踪更改的详细信息
--检查数据库是否开启更改跟踪及参数
select db_name(database_id) as database_name,* FROM sys.change_tracking_databases as a;
--查询sys.change_tracking_tables目录视图可以获得启用跟踪更改的详细信息.
select
'ALTER TABLE '+a.objectname+' ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED= '
+ case when a.IS_TRACK_COLUMNS_UPDATED_ON='1' then 'ON' else 'OFF' end+');' as merge_sql,*
from (select object_name(object_id) as objectname,* from sys.change_tracking_tables) as a;