Page 1 of 1

Elegant way to stop a job when there's a row in a tbl?

Posted: Fri Mar 11, 2005 5:26 pm
by cbres00
I need to extract data from a MS Sql table, but I want to do it only if there's a 'load completed' semaphore row in the table. In addition, I want to retry the job once every 15 minutes for one hour. If after an hour the row doesn't exist, I exit with a successful completion code.

If I do a 'before sql' query to see if the row exists, there's no mechanism to gracefully exit the stage/job...or maybe there is and I don't know it (which is entirely possible!).

How would you all execute this?

Thanks,
cbres00

Posted: Fri Mar 11, 2005 9:20 pm
by kduke
If it was me then I would create a job and select this into a hash file. I would write a routine to read this and return a different value if it found it.Call this routine in a sequence. Have links for each value returned. One to run the job another to sleep 15 minutes. You can do sleep in a routine.

Posted: Sat Mar 12, 2005 3:38 am
by Sainath.Srinivasan
What if your load continues for more than 1 hour? Do you want to stop the load or let it continue in the background? Also what message must the user obtain from the process?

What if there is a lock and you try to reload the records again into the table?