Groups | Blog | Home
all groups > sql server programming > november 2004 >

sql server programming : TSQL to find all running SQL Agent jobs


Hassan
11/30/2004 11:13:32 PM
I've looked at sp_help_job but cant really seem to find out current
execution status . So basically I want to be able to run a TSQL that will
list all jobs that are currently running

John Bell
11/30/2004 11:45:03 PM
Hi

sp_help_job returns a current_execution_status for the jobs, you can also
pass a @execute_status parameter to sp_help_job a value of 1 is for a
currently executing job. You can see what sp_help_job is doing by looking at
the definition in msdb, if it is sufficient then you can use it as the basis
for your own procedure.

More information on sp_help_job is available on Books online

John


[quoted text, click to view]
avnrao
12/1/2004 1:04:24 PM
sp_help_job @execution_status = 1 will return all jobs that are currently
executing.

you can refer to system tables like sysjobs* for making the query. but its
not recommended. always use sp_* procedures.

Av.
http://dotnetjunkies.com/WebLog/avnrao
http://www28.brinkster.com/avdotnet

[quoted text, click to view]

AddThis Social Bookmark Button