Reputation: 3032
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
Upvotes: 2
Views: 1502
Reputation: 3032
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)
Upvotes: 4
Reputation: 878
In the current SSDT version there is no way to use SQLCMD variables in a schema comparison. But there is a workaround: just debug your database (F5) using the right SQLCMD variables and compare the resulting staging database with the target one.
Hope this helps.
Upvotes: 1