I need to update some values into a database as soon as all the tasks of Executing Service have finished executing there jobs.
In other words, I want do something like status when the all jobs finished directly change this status .
I think that doing stored procedure like:
Update (Table Name ) Set ( Field ) = 1 )
But i don't know, how to execute the stored procedure, when the job finished.
Best Answer
Because there are several apparently semi-independent jobs running, I would suggest implementing a status table and creating a trigger for that table. It depends on how complex you want to be, but let's keep it to a very simple example. Perhaps a table:
When the first job starts it could set all columns to 0. Then as job one finishes it would "UPDATE dbo.JobGroupStatus SET Job1 = 1", then Job2 when it finishes would update Job2, etc. Create a trigger on that table that discerns when all jobs have finished.
Of course, you would need to have a periodic check that would determine that apparently all 6 jobs will not finish and report failure.
This little snippet of code is just a toy, not a serious production program. But perhaps it offers you an idea or two about how you might approach your problem.