Start stored procedures sequentially or in parallel

后端 未结 4 1268
自闭症患者
自闭症患者 2021-02-03 11:12

We have a stored procedure that runs nightly that in turn kicks off a number of other procedures. Some of those procedures could logically be run in parallel with some of the o

4条回答
  •  旧巷少年郎
    2021-02-03 11:40

    Create a couple of SQL Server agent jobs where each one runs a particular proc.

    Then from within your master proc kick off the jobs.

    The only way of waiting that I can think of is if you have a status table that each proc updates when it's finished.

    Then yet another job could poll that table for total completion and kick off a final proc. Alternatively, you could have a trigger on this table.

    The memory implications are completely up to your environment..

    UPDATE: If you have access to the task system.. then you could take the same approach. Just have windows execute multiple tasks, each responsible for one proc. Then use a trigger on the status table to kick off something when all of the tasks have completed.

    UPDATE2: Also, if you're willing to create a new app, you could house all of the logic in a single exe...

提交回复
热议问题