This post announces the availability of a small helper utility that will allow you to maintain your database.sqlcmdvars files from a command line tool.
What is the scenario? If you are using vsdbcmd.exe to deploy your schema, you include the Database.sqlcmdvars, however vsdbcmd.exe does not have an option to override the values of the SQLCMD variables used at the command line level like you can do when using MSBuild (assuming you chained the SQLCMD variable to a MSBuild property).
This little tool, named SqlCmdVars.exe, lets you update you Database.sqlcmdvars file from the command line, dump its content, query the existence of variables, delete an existing variable, update the value of an existing variable and add new variable with value if required.
The tool has a couple command line switches, if you no longer know you can always do SqlCmdVars.exe –? and it will provide you the list of command line parameters available. You can interchange the forward slash and dash as the parameter prefix, so /? and –? have the same effect.
@echo off SqlCmdVars.exe %* IF ERRORLEVEL 2 @echo NOT FOUND IF ERRORLEVEL 1 @echo FOUND
The default ERRORLEVEL for other operations is 0 (zero), errors are indicated through error levels 99 and up.
BuildVersion = 2009.07.31.01 DefaultLogPath = d:\dbs\MSSQL10.MSSQLSERVER\MSSQL\DATA
You can download SqlCmdVars.zip from the DBProj.com website.