Find All Enabled and Running Jobs in SQL Server
As a DBA sometimes we need to verify certain details for currently running jobs, jobs steps, jobs description and commands and queries used in jobs etc. We can extract these details by joining tables sysjobs and sysjobsteps and can find all Enabled and Running Jobs in SQL Server with a simple query.
SELECT database_name, name AS JobName, step_name AS JobStepName, enabled AS IsEnabled, description, command FROM msdb.dbo.sysjobs SJ JOIN msdb.dbo.sysjobsteps SJS ON SJ.job_id = SJS.job_id WHERE SJ.enabled = 1 --1 for enabled and 0 for disabled |
On my test server it has returned below details.
Reference: Manzoor Siddiqui [www.SQLServerLog.com]