Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

SQLServer 2005 introduced something called SQLCMD Mode msdn link.

At first glance this mode adds variable subsitution from command line batch files, and some escaping to OS commands.

Is this feature used in your environments, production or test?

share|improve this question
    
I know it's a bit late but I feel I should close this question as the way it is phrased it solicits multiple equally valid answers (see the faq for more details) –  Jack Douglas Nov 3 '12 at 5:12
add comment

closed as not constructive by Jack Douglas Nov 3 '12 at 5:12

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

6 Answers

up vote 3 down vote accepted

I use the sqlcmd mode in SSMS on occasion. Typically when migrating databases from one environment to another. For example if I need to backup the database from production, then restore it to dev, I'll do this all in one script using SQLCMD mode to switch servers. I've used to here and there for one thing or another, but I don't use it all that often.

share|improve this answer
add comment

I actively use this when deploying logshipping as it allows me to do everything within a single script connecting to the primary, monitor and secondary servers.

share|improve this answer
add comment

Used it as well in doing data processing before we migrated over to SSIS. It is definitely a useful feature.

share|improve this answer
add comment

I'm using sqlcmd mode mostly for changing servers in a single script. But the nicest feature for me is that I can combine batches and sql files in a single package (a combination of running a report + an ssis package to import/export data in csv file + some data change scripts).

One can execute sql files from batches using parameters provided from a central batch file that executes everything and has all parameters in one place. That's a sweet thing for me!

share|improve this answer
add comment

I think, SQLCMD a great tool, it replaces old ones ISQL and OSQL starting from sql server 2k5. It lets you enter TSQL statements, system procedures, and script files at the command prompt. And MSSMS has implemented calls of this tool.

share|improve this answer
    
I'm using sqlcmd as replacement for osql myself, but I'm not using the new features. I want to know if those where used. –  bernd_k Jan 10 '11 at 6:13
add comment

I use sqlcmd for running admin scripts, batch jobs and reports. I also use sqlsplus, which is like Oracle SQL*Plus, but for SQL Server (found it at www.sqlsplus.com)

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.