question

Ahysu avatar image
Ahysu asked

Parallel Procedures by Trans-SQL

Hi, I need to made a process that need to made 3 part of it working in parallel. Well I don't know how made it using trans-SQL. I add a diagram about it:![alt text][1] Thanks for your time, [1]: /storage/temp/4312-diagrama.png
sql-server-2008procedure
diagrama.png (30.4 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
ThomasRushton avatar image
ThomasRushton answered
Doing this in straight T-SQL is tricky, as generally a single SQL Server script / procedure is executed one statement at a time in serial, and there's no real concept of that sort of flow control. Having said that, you do have a couple of options in the SQL Server world: 1. use SSIS (SQL Server integration Services) - this contains the control structures to allow you to build your desired flow 2. If you want to keep it in T-SQL, then you could use the SQL Server agent and set up a series of jobs. Here you would have three jobs for Processes 1, 2, 3, and these would be controlled by a separate job that does the pre-processing, kicks off the three other jobs using msdb.dbo.sp_start_job, and then sits in a loop periodically checking for those jobs to complete before doing the final step.
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Interesting that these are 2 approaches you are trying to avoid. Why are you trying to avoid these?
1 Like 1 ·
There are exactly the two methods I knew but I am trying to avoid. I think that in the end I will have to do so. To see that such ends up working. Thanks for everything.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.