SQLCMD Variables

ChrisYatesChrisYates United States Posts: 17 Bronze 5
edited July 30, 2012 6:32AM in SQL Multi Script
I have a set of SQL scripts that utilize SQLCMD Variables......for example

:setvar Pub_Server "[team-1]"
:setvar Sub_Server "[team-1\Reporting]"
:setvar SubscriberDB "Reporting_team1"
:setvar PostSnapshotScript "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\repldata\index\indexfile.sql"

I've changed my variable names but you should be able to see the gist of what I am trying to accomplish. This portion of the script is at the top of my SQL script and will be called later on in the script. This works well in SSMS but doesn't using this utility. I receive a error - Incorrect syntax near ':'.

Is the use of SQLCMD Variables not supported with this utility? I could break the script out into 5 different variations and hard code in the values but trying to stay away from that.
"Leadership Through Service"


Sign In or Register to comment.