July 21, 2006 at 8:12 am
Where would I find in the system Tables/Fields that will let me know which jobs are currently executing?
- Roger
July 21, 2006 at 8:46 am
Check out the MSDB database tables
Sysjobs
SysjobHistory
SysjobSchedules
SELECT * FROM msdb..sysjobs
SELECT * FROM msdb..sysjobhistory
SELECT * FROM msdb..sysjobschedules
N 56°04'39.16"
E 12°55'05.25"
July 21, 2006 at 8:49 am
Hi Roger,
You'll need to use the extended procedure sp_sqlagent_enum_jobs, like so:
exec master..xp_sqlagent_enum_jobs 1,''
The running column will tell you whether a job is currently running. It only provides the job_id so you'd need to output those results into a temporary table, which you then join on msdb..sysjobs to get the job name.
Incidentally, I wouldn't trust the values you get out of msdb..sysjobhistory table.
Hope that helps,
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply