info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance



T-SQL - Get Currently Running Jobs
by BF (Principal Consultant; Architecture; Engineering)
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