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 2000 Forums
 SQL Server Development (2000)
 Setting Success/Failure from a SP in a Job

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-08 : 09:55:54
Wexy writes "I want to create a job with two steps, the first needs to run a Stored Procedure, and the second is to be run if the first step is successful, but not run if it fails.

My problem is that I cannot seem to set a "failure", from the Stored Procedure, that is recognized by the Job Manager.

I have tried setting return codes and the RAISERROR function.

Any ideas ?"

Lou
Yak Posting Veteran

59 Posts

Posted - 2002-02-08 : 16:01:48
Try this. HTH.

Within the first Sp called "myFirstSp":
select @myError=@@error
return @myError

Execute the Sp:
exec @myError= myFirstSp
if @myError=0 exec mySecondSp





Edited by - Lou on 02/08/2002 16:02:54
Go to Top of Page
   

- Advertisement -