Is there a query to check what a Jobs that ran between to given times. I can check the Jobs that are scheduled between two times but I dont want that.
Example I want to know what the Jobs that ran between 16:00:00
and 17:00:00
There can be cases where job scheduled at 15:00:00
might running for more than 1 hour I want those as well. I did search in google all I got is jobs those are scheduled between two times
Best Answer
Well you could run the following query to retrieve the jobs run between two times or you could change the
WHERE
expression to catch jobs that ran for a certain duration.As McNets pointed out there are various ways to retrieve the date you require. It's good to know though that the dates and times are defined as
INT
in thesys.jobsxxxx
tables and not as dates and times as one would expect.Reference: dbo.sysjobhistory (Transact-SQL)(Microsoft Technet)