SQLTeam.com | Weblogs | Forums

SSDT DB Project settings & Change Tracking

Hello,

Here is my situation: I have change tracking enabled on a database and on few tables in it.
I want to apply a dacpac to this but via building a DB project in VS. Problem is the DB project properties has an option Change Tracking which if left unchecked tries to generate a statement which turns of change tracking, following is what it does:

ALTER DATABASE [$(DatabaseName)]
SET CHANGE_TRACKING = OFF
WITH ROLLBACK IMMEDIATE;

The above obviously throws an error as change tracking is enabled on the tables. What I want is to omit this statement all-together but not able to do so. It is always put in by default if change tracking is left unchecked when you build the project.
I want to retain change tracking when deploying the script that is generated from the build. I have VS/SSDT 2017.

One can check the change tracking setting in VS from here, it has few screenshots:

Has anyone come across this problem, any possible solution?

Found few properties that can be used:

ScriptDatabaseOptions: will not script out change tracking statement along with the other generic db options

The above should be used I think along with IgnoreTableOptions property to achieve what I am looking for.