How to provide vsdbcmd deploy command line target dbschema sql command variables?

907 Views Asked by At

The Visual Studio (2010) gui provides options for specifying second command variable file for target. I however cant find this option for the command line implementation - vsdbcmd.exe.

Running vsdbcmd deploy for dbschema to dbschema with only source model command variables given results that objects that implement the variables are treated as having changes. Resulting in incorrect(improper) update script.

The command i use currently:

vsdbcmd.exe /a:deploy /dd:- /dsp:sql /model:Source.dbschema /targetmodelfile:Target.dbschema /p:SqlCommandVariablesFile=Database.sqlcmdvars /manifest:Database.deploymanifest /DeploymentScriptFile:UpdateScript.sql /p:TargetDatabase="DatabaseName" 

What im looking for is the /p:TargetSqlCommandVariablesFile, if such thing exists ...

The result script is the same as running so GUI compare without specifying the sqlcmd vars for target

2

There are 2 best solutions below

0
On

In the end i found no info on the possibility to do what I required - checked vsdbcmd libs with IL spy for hidden parameters - didn't find any.

Reached my goal by parsing the dbschema files for both target and current and parsing the cmd variable values directly into them - then doing the compare on modified dbschemas. This approach no longer allows to change sql cmd vars in resulting script (as the values are already baked into code), however this was deemed as acceptable loss.

Not the most beautiful solution but so far i have had no issues with it.

1
On

I found what looks like full documentation for VSDBCMD.EXE at this link.

I think you may be looking for something like:

/p:SqlCommandVariablesFile=Filepath