How to check if change tracking is enabled

2020-08-09 05:34发布

I'm trying to determine if Change Tracking is already enabled on my database before I run the ALTER DATABASE command to enable it. I am trying to prevent errors with these scripts if run multiple times.

I checked in sys.databases and sys.dm_tran_commit_table but was unable to find what I was looking for.

1条回答
看我几分像从前
2楼-- · 2020-08-09 06:11

You can use this query:

SELECT * 
FROM sys.change_tracking_databases 
WHERE database_id=DB_ID('MyDatabase')
查看更多
登录 后发表回答