SQL Server Utilties
Bcp, osql, and other command-line SQL Server utilities
This is Part 2 of the series on the for command. In an earlier article I covered using for to deploy SQL scripts against multiple servers. I'm going to enhance this a little by specifying multiple databases as well, and generating server and database lists automatically. I'll also add a little enhancement for deploying scripts in a particular order of execution.
In the previous article I created a text file (servers.txt) that contained the names of the SQL Servers against which a number of scripts needed to be deployed. The assumption was that there was only a single database (with...
I've already posted an example in a previous article, and I'm going to post a couple more on neat things you can do with the DOS for command.
I recently helped out a friend with a method to deploy stored procedures to multiple servers. Previously he was generating the scripts and running them manually in Query Analyzer, for up to 8 different servers. Getting bored and making mistakes, plus needing it to be foolproof for others to use, he was looking for a better way. Here it is. :)
The for command can enumerate through file contents as well as...