Is there a way to tell if a variable is defined on command line using SQLCMD?
Here is my command line:
sqlcmd -vDB="EduC_E100" -i"Z:\SQL Common\Admin\ProdToTest_DB.sql"
Inside ProdToTest_DB.sql I would like to set some sort of conditional IF to check if the variable does not exists and define it if it does not.
IF NOT $(DB) :setvar DB "C_Q200" END
I want to allow the script to be run both from command line and inside of SSMS.
Thanks in advance.