visual-studio-2013sql-server-data-toolsschema-compare

Is there anyway to set SQLCMD variables in VisualStudio Schema Compare


I'm using vs2013 data tools and trying to do comparisons of my database project and databases in different environments.

But my tsql code uses synonyms to access different databases

I can set this up with publish files as I can set each SQLCMD Variable to the correct environmental setting, and when the script is generated the correct db/server/whatever is inserted.

for example

DEV   $(Contoso)  = "Contoso_dev"
TEST  $(Contoso)  = "Contoso_Test"
PROD  $(Contoso)  = "Contoso_Prod"

However, when I'm doing a database comparison (using .scmp), i have no such option to set CMDvars, so I cant successfully compare with TEST environment because the synonyms are set by project properties which are pointing to the dev environment.

Is there anyway to set CMDVars in SCMP file


Solution

  • Revisited this issue with VS2015 and SSDT 14.0.51215.0 (Dec 2015). (not sure if this will work with original configuration listed above)

    By setting the LOCAL value of the cmd Variable, it replaces the cmd variable correctly (regardless of what DB Server you're looking at)

    (this did not work, just having the default set)

    enter image description here