January 21, 2010 at 11:31 am
is it possible to pass parameters into sqlcmd. For instance user A wants to pass inthe location of the folder where his files are stored and in turn replace the location in the command below
the sqlcmd that is used is as following:
:r "\\user\c$\folder\xyz.sql"
January 22, 2010 at 8:06 am
Yes, you can use variables with sqlcmd, see Books Online (http://msdn.microsoft.com/en-us/library/ms188714.aspx) for more details.
E.g.:
In your script change the definition to:
:r $(scriptfile)
Assign the variable at execution:
sqlcmd.exe -v scriptfile="\\user\c$\folder\xyz.sql"
ML
---
Matija Lah, SQL Server MVP
http://milambda.blogspot.com
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy