Declare @jobId as uniqueidentifier
select
j.job_id,j.Name as "Job Name", j.description as "Job Description", CONVERT(DATETIME, RTRIM(h.run_date))
+ ((h.run_time / 10000 * 3600)
+ ((h.run_time % 10000) / 100 * 60)
+ (h.run_time % 10000) % 100) / (86399.9964) AS run_datetime,
case h.run_status
when 0 then 'Failed'
when 1 then 'Successful'
when 3 then 'Cancelled'
when 4 then 'In Progress'
end as JobStatus
from sysJobHistory h, sysJobs j
where j.job_id = h.job_id and h.run_date =
(select max(hi.run_date) from sysJobHistory hi where h.job_id = hi.job_id ) and h.run_status= 1
and cast(cast(h.run_date as varchar(8)) as date) = cast('06/27/2016' as date)
order by 2
This blog is created to add all the information and experiences that I have learnt while working on MS sql server as a DBA. The blog is also updated frequently with the real world problem that I encounter hands on at work and the resolutions to resolve them. I hope this blog will be of some use to you and you will revisit. Thank you for stopping by and you are welcome to leave comments.
Showing posts with label sqljobs. Show all posts
Showing posts with label sqljobs. Show all posts
Monday, June 27, 2016
Subscribe to:
Posts (Atom)