Check Agent Job History


  
 
 select distinct
 j.name as 'JobName',
 msdb.dbo.agent_datetime(run_date, run_time) as 'RunDateTime',
 ((run_duration/10000*3600 + (run_duration/100)%100*60 + run_duration%100  )  ) as 'RunDurationSeconds'
From msdb.dbo.sysjobs j 
INNER JOIN msdb.dbo.sysjobhistory h 
 ON j.job_id = h.job_id 
where   
msdb.dbo.agent_datetime(run_date, run_time) =Dateadd( hour, 4,Cast(Cast(getdate() as date) as datetime)) --4am
--BETWEEN '2016-05-02 04:00:00.000' and '2016-05-02 04:01:00.000'   
 
order by JobName  
 

 
Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s