Users: 15,000+ | Page Views: 50,000+ | PPS: 2.5
TechDevOps.com
Explore Tools
{Experts in Microsoft SQL Server Operations, Performance, HA/DR, Data Migrations & Cloud Computing}



T-SQL - Get Currently Running Jobs
by BF (Senior MSSQL Operations - Enterprise, Cloud, Strategy)
2018-09-26







T-SQL:

Select
sj.Name as 'Job Name', suser_sname(owner_sid) as 'Job Owner', sja.Session_ID,
DateDiff(mi,sja.Start_Execution_Date, GetDate()) as 'Run-Time (mi)',
sja.Start_Execution_Date, sja.Stop_Execution_Date
FROM msdb.dbo.sysjobs sj
INNER JOIN msdb.dbo.sysjobactivity sja ON sj.job_id = sja.job_id
WHERE
sja.start_execution_date Is Not Null AND sja.stop_execution_date Is Null