ChrisM
ChrisM

Reputation: 167

Checking a SQL job status in C# using sp_help_job

This similar question gave the solution that in order to check the status of a job in C# you must run sp_help_job. The problem is when I try the query out in SQL, I'm getting an error from SQL Server saying "Could not find stored procedure 'sp_help_job'.

I tried running this SQL code in MSS 2008:

exec sp_help_job

Can someone post the exact query to find out the status of a job I just ran?

Upvotes: 1

Views: 6560

Answers (3)

Babaike
Babaike

Reputation: 21

I had the same issue with running the EXEC command. However, changing the line to "exec msdb.dbo.sp_help_job" worked.

Upvotes: 2

Pondlife
Pondlife

Reputation: 16240

If you are writing C# code, the easiest solution would probably be to use the SMO API to get the information you need. You can use the Job class to get the current status and last result of a job.

Upvotes: 5

Justin
Justin

Reputation: 2103

Change it to:

exec msdb.dbo.sp_help_job

Upvotes: 6

Related Questions