May 26, 2016 at 2:09 pm
I want to have a job step that checks to see if a total in a table's column is 0 or not. If it is zero then go to the next job step, else fail the job (this will take it to a job step that leads to different processing.)
So the base of this t-sql job step would be...
Select Sum(Go_No_Go) as go_no_Go
from server_manager.dbo.ztb_Replication_Run_State
so what would I have to do.. to get it to pass the step on this returning a 0 or fail if anything else?
May 26, 2016 at 2:16 pm
dwilliscp (5/26/2016)
I want to have a job step that checks to see if a total in a table's column is 0 or not. If it is zero then go to the next job step, else fail the job (this will take it to a job step that leads to different processing.)So the base of this t-sql job step would be...
Select Sum(Go_No_Go) as go_no_Go
from server_manager.dbo.ztb_Replication_Run_State
so what would I have to do.. to get it to pass the step on this returning a 0 or fail if anything else?
Can this be done in one step?
if <Condition> = True
Call true procedure
Else
Call False procedure
Otherwise, there are a couple options
1. Set up multiple jobs, not steps, and run sp_start_job to start the appropriate job
2. Set up step 1 to go to step 2 on success, and step 3 on error. Use RAISEERROR if your condition fails.
3. Create an SSIS package that does the processing based on the logic, and call that.
There are probably a few other suggestions, but I'm out of other ideas!:w00t:
Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply