Search code examples
sqlsql-servert-sqlparallel-processingdts

How can I run sql server stored procedures in parallel?


I want to do something like:

exec sproc1 and sproc2 at the same time
when they are both finished exec sproc3

I can do this in dts. Is there a way to do it in transact sql? Or is there a way to do it with a batch script (eg vbs or powershell)?


Solution

  • sp _ start _ job

    I'm doing a similar thing at the moment, and the only way I've found to avoid using SSIS or some external shell is to split my load routine into 'threads' manually, and then fire a single master sqlagent job which in turn executes as many sp _ start _ job's as I have threads. From that point, they all run autonomously.

    It's not exactly what we're looking for, but the result is the same. If you test the job status for the sub jobs, you can implement your conditional start of sproc 3 as well.

    What's the point in 8 cores if we can't use them all at once?