Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Job Details

Author  Topic 

sanjay5219
Posting Yak Master

240 Posts

Posted - 2010-11-09 : 10:08:36
Dear All,

I want a query by which i can know the below output

Job_Name-Last_Run_Date

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-11-09 : 10:27:10
Example:
select
jobs.[name] as Jobname,
jobs.[enabled] as Enabled,
convert(varchar(10),convert(datetime,convert(varchar(10),hist.run_date)),101) as LastRun,
jobs.[description] as Description
from msdb.dbo.sysjobs as jobs
left join
(select
job_id,
max(run_date) as run_date
from msdb.dbo.sysjobhistory
group by job_id
)as hist
on hist.job_id = jobs.job_id
order by hist.run_date desc



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -