Search

Wednesday, April 10, 2013

Enable Change Tracking on all Tables in a Database

The following script is definitely a sandbox script. It will enable Change Tracking on every table in your database, so please do not try this in a production without first understanding the impact.
First, enable Change Tracking at the database level.

USE [master]
GO
ALTER DATABASE [YOUR_DATABASE] SET CHANGE_TRACKING = ON
 (CHANGE_RETENTION = 2 DAYS, AUTO_CLEANUP = ON)
GO

No comments:

Post a Comment