Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 how to "control" job status

Author  Topic 

tocroi72
Yak Posting Veteran

89 Posts

Posted - 2010-06-25 : 12:28:15
hi I have a job that has 2 steps ,
step 1 is executing a stored procedure.
next step need to execute base on the result of the first step.

basically i want to say if @i = 1 (@i is variable from the first step) then the job is successful and the next step is executed
otherwise i want it to fail so the next step doesn't get executed

Please help. Thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-25 : 14:54:16
Although you could technically do it either by forcing a failure of step 1 or by logging the result to a table and then reading it in step 2, I would instead recommend that you do the whole thing in one job step.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tocroi72
Yak Posting Veteran

89 Posts

Posted - 2010-06-25 : 16:28:50
good idea. Thanks I'll try that.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-25 : 17:23:02
You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -