Find articles on computer software, programming, ASP.net, Sql server, databases, C#, websites, Internet, Windows, Outlook macros.
Sqlcmd utility reference with description of setvar is here. http://msdn.microsoft.com/en-us/library/ms162773.aspx
There is a good article on variables in sqlcmd using setvar. http://blogs.msdn.com/gertd/archive/2007/01/08/variables-to-the-rescue.aspx
In Sql Server Management Studio, script filenames end with .sql. For sqlcmd scripts, I use .sqlcmd.sql to distinguish from a transact only .sql script. www.programmer.bz/Forum/tabid/259/forumid/8/postid/47/scope/posts/Default.aspx
Unfortunately, you cannot use sqlcmd script variables within the :setvar statement. So you cannot do something like this.
:setvar pathscripts "c:\sql\scripts\" :setvar pathmyscripts $(pathscripts)"my\"
You can use sqlcmd script variables in other sqlcmd and transact sql statements.
In sqlcmd statements you do not quote the variables.
:setvar pathscripts "c:/sql/scripts/" :r "$(pathscripts)"myscript.sqlcmd.sql
In transact sql statements you must quote the sqlcmd variables, otherwise you get errors from transact sql.
print 'pathscripts=$(pathscripts)'
Name (required)
Email (required)
Website
Notify me of followup comments via e-mail
AWeber Email List Marketing Test Drive
Use email marketing to convert targeted subscribers to customers. Let the system sell itself for you!
MAKE YOUR PC SUPER FAST Discover 5 Shockingly Simple Techniques That Will Make Any Old Computer Run At Top Speed.
Drive Traffic to Your Website with Article Underground. Increase Your Visitors and Your Profits.
HOW TO HYPNOTIZE ANYONE AT WILL! Amazing Secrets to Hypnotize Anyone, Anywhere, at Any Time for Whatever Reason.