T-SQL Query to find currently running jobs | SansSQL

Sunday, August 18, 2013

T-SQL Query to find currently running jobs

Here is a T-SQL query to find the currently executing jobs.
The output of this query will be the list of jobs that are currently running along with the number of seconds it is been running.
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
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

1 comment:

Jodi W. Brown said...

But it shows how we can join with labor now to plot the steps for a just transition from dependency on defense contracts for good paying union jobs to a local sustainable economy.Executive Employers Review

Post a Comment