SQLCMD Variables

Single-click script execution on multiple SQL Servers.

Moderators: JonathanWatts, Anu Deshpande, dlkj, Colin Millerchip, Michelle Taylor

SQLCMD Variables

Postby cyates04 » Thu Feb 16, 2012 2:46 pm

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.
cyates04
 
Posts: 5
Joined: Fri Nov 04, 2011 7:58 pm
Location: Kentucky

Postby dlkj » Fri Feb 17, 2012 3:03 pm

Hi cyates04,

SQL Multi Script doesn't support SQLCMD variables. We have rough feature parity with SSMS which doesn't support them either.

Thanks,
--
Daniel
dlkj
 
Posts: 151
Joined: Tue Aug 14, 2007 5:10 pm
Location: Red Gate Software, Cambridge

Postby cyates04 » Mon Feb 20, 2012 7:47 pm

Thanks for the quick response.
cyates04
 
Posts: 5
Joined: Fri Nov 04, 2011 7:58 pm
Location: Kentucky

SQLCMD supported by SMSS

Postby dcam » Tue Jul 24, 2012 6:40 am

Hi,

The SQLCMD syntax is supported by management studio. Using the 2008 client there is the option under the query menu to execute scripts using the SQLCMD syntax.

Will there be support for SQLCMD syntax in future versions on MultiScript?

David
dcam
 
Posts: 1
Joined: Tue Jul 24, 2012 6:36 am

Postby dlkj » Mon Jul 30, 2012 11:32 am

Hi David,

Thanks for letting us know about that. It's amazing what's hidden in SSMS.

Unfortunately we aren't planing to make any updates to SQL Multi Script in the immediate future.

Daniel.
dlkj
 
Posts: 151
Joined: Tue Aug 14, 2007 5:10 pm
Location: Red Gate Software, Cambridge


Return to SQL Multi Script 1

Who is online

Users browsing this forum: No registered users and 1 guest