Determine if SQL CMD variable is defined
Simple method to determine if a SQL command variable has been defined.
begin try -- do a test to see if this sql cmd variable has been defined. IF (N'$(WebServer)' = N'') begin NoOpTest1: end end try begin catch -- if we had an error, it means the variables have not yet been set. -- Set them now. :setvar WebServer "www.myserver.com" :setvar Environment "live" end catch