Monday, 31 December 2018

Get the Active (enabled) SQL server job Agent jobs

When we are creating the SQL server agent job, it is stored on the sysjobs table in msdb. With the help of enabled flag, we will get active and disable job.
Below script is use to get the list of enabled job

select DISTINCT
sj.name As [job name],sysc.name as [job category],
sjc.step_name as [Step name],sjc.subsystem,
sc.name as [schedule name]
from sysjobs sj
inner join syscategories sysc
ON sysc.category_id=sj.category_id
LEFT OUTER JOIN sysjobsteps sjs
on sjs.job_id=sj.job_id
LEFT OUTER JOIN sysjobsteps sjc
ON SJ.job_id = sjc.job_id
LEFT OUTER JOIN sysschedules sc
on sc.schedule_id=sjc.step_id
where sj.enabled=1

  

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts