Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server Job Step report success/failure using T-SQL

Status
Not open for further replies.

goitz

Technical User
Jun 29, 2005
7
CA
I am trying to use a job node to decide the order of steps based on criteria.

if datepart(dw,getdate()) = 1
return job Success
else
return failure

this way i can add a step if its sunday and skip it every other day.

 
Hi

you could get the job to fail using something like


if datepart(dw,getdate()) != 1
RAISERROR (N'Error Incorrect Day', 16, 1,N'number',5)

this would fail on ever day but 1 and not proceed to the next step, unless you specify it to do something on failure i.e go to a dummy last step and exit cleanly, it really depends on what you want to do

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top