SQL SERVER – Running Multiple Batch Files Together in Parallel
Posted
by pinaldave
on SQL Authority
See other posts from SQL Authority
or by pinaldave
Published on Sun, 06 Mar 2011 01:30:15 +0000
Indexed on
2011/03/06
8:13 UTC
Read the original article
Hit count: 501
Pinal Dave
|PostADay
|sql
|SQL Authority
|SQL Query
|SQL Scripts
|SQL Server
|SQL Tips and Tricks
|SQL Utility
|T SQL
|Technology
Recently I was preparing a demo for my next technical session, I had to do run a SQL code in parallel. I decided to use Batch File to run the code.
I am not the best guy to with command shell so I did it with following setup.
Code of tsql.sql
SELECT 1 ColumnName
Code of command.bat
sqlcmd -S . -i tsql.sql
timeout 100
Code of AllBatch.bat
start cmd.exe /C “command.bat”
start cmd.exe /C “command.bat”
start cmd.exe /C “command.bat”
Now I ran AllBatch.bat and it run all the three files in parallel and simulated my needed scenario.
I believe there should be simpler way using power-shell. Anybody want to come up with equivalent code which is improvement to this code?
Reference: Pinal Dave (http://blog.SQLAuthority.com)
Filed under: Pinal Dave, PostADay, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQL Utility, T SQL, Technology
© SQL Authority or respective owner