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?
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 only takes a minute to sign up.Sign up to join this community
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.
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!