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)
 SQL JOb Return Code?

Author  Topic 

Sanatan
Starting Member

19 Posts

Posted - 2009-02-09 : 12:14:45
Is there a way to retrieve a job return code in SQL 2000?

I am trying to execute SQL Job via Console App using sp_start_job. But the sp_start_job does not return any code if the job completed successfully or failed. I want to capture the return code and return back to the calling program. How do I do this? Any help is appreciated.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-09 : 13:08:16
You would have to query the msdb job tables to see what happened as there is no way to receive this information. I would instead suggest that the console app just perform the same steps that the SQL job does that way you can receive the status.

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

Subscribe to my blog
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-09 : 14:39:33
Jobs are run asynchronously and that's why sp_start_job cannot tell if job completed with success or failure.
It can however tell you if job started successfully or not.

sp_start_job return control immediately, whereas a job can run for hours.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -