SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


sqlAgent - Quit without running downstream job-Steps


sqlAgent - Quit without running downstream job-Steps

Author
Message
etl2016
etl2016
SSC Eights!
SSC Eights! (918 reputation)SSC Eights! (918 reputation)SSC Eights! (918 reputation)SSC Eights! (918 reputation)SSC Eights! (918 reputation)SSC Eights! (918 reputation)SSC Eights! (918 reputation)SSC Eights! (918 reputation)

Group: General Forum Members
Points: 918 Visits: 334
Hi,

I have a scenario, in which there are 5 interdependent job-steps in my sqlAgent job. (Step x+1 depends on the success of Step x)

My requirement is to let the header job-step to have the capability to give a Go/No-go to the downstream job-steps on a need-basis. If the header job-step decides that it is not appropriate day/time for the downstream to execute, then, it should be able to mark the entire sqlAgent job "success" without letting the downstream dependent job-steps to run.

Basically, my header job-step decides the appropriateness of the entire job-stream to run or go to sleep based on a config table.

Please let me know if/how this scenario is achievable in sqlAgent.

thanks
Sue_H
Sue_H
SSC Guru
SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)

Group: General Forum Members
Points: 66639 Visits: 13848
etl2016 - Tuesday, February 6, 2018 3:26 PM
Hi,

I have a scenario, in which there are 5 interdependent job-steps in my sqlAgent job. (Step x+1 depends on the success of Step x)

My requirement is to let the header job-step to have the capability to give a Go/No-go to the downstream job-steps on a need-basis. If the header job-step decides that it is not appropriate day/time for the downstream to execute, then, it should be able to mark the entire sqlAgent job "success" without letting the downstream dependent job-steps to run.

Basically, my header job-step decides the appropriateness of the entire job-stream to run or go to sleep based on a config table.

Please let me know if/how this scenario is achievable in sqlAgent.

thanks


You can control the flow of things like that where you go to the next step on success and then on failure go to some last job step of just a print statement so it shows up in the history. And the second to the last step before that would be on success quit job reporting success, on failure, fail job. So you only get to the last step when your condition check is no go.
That's usually what you see for things with conditional job steps and you can use similar things to skip steps.

You may want to consider two different jobs though. The first job being the condition check, your Go/NoGo in an if statement. if the condition is true, use sp_start_job to start the job that has the steps with the processing. If false, print 'Not okay to run at this date/time'.
That gives you a better idea on when and how often the processing job runs without having to check the specific steps when it's all in one job. And allows the first job to report a failure when it fails outside of your check for Go/NoGo if that's the case (table dropped, login failed, timeouts)

Sue



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search