T-SQL Query to find currently running jobs

T-SQL Query to find currently running jobs

SELECT  J.name as Running_Jobs, 
  JA.Start_execution_date As Starting_time,
        datediff(ss, JA.Start_execution_date,getdate()) as [Has_been_running(in Sec)]
FROM msdb.dbo.sysjobactivity JA<a name="more"></a>
JOIN msdb.dbo.sysjobs J
ON J.job_id=JA.job_id
WHERE job_history_id is null
      AND start_execution_date is NOT NULL

ORDER BY start_execution_date

No comments:

Post a Comment