how would I write a t-script to view all the errors in my maintenance plan history and agent Job History?

I am needing a script that will view all the errors in my SQL servers maintenance history and Agent job history. How can I do this? and what would the script be?
Steve SamsonAsked:
Who is Participating?
 
jorge_torizConnect With a Mentor Research & Development ManagerCommented:
SELECT * FROM sysjobhistory
0
 
jorge_torizResearch & Development ManagerCommented:
Well, you will need the sysjobs_view view too
0
 
Steve SamsonAuthor Commented:
What about the maintenance plan history?
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
jorge_torizConnect With a Mentor Research & Development ManagerCommented:
The maintenance plan is built on tasks of SQL Server Agent, through this views you can get the history of your maintenance plan
0
 
Steve SamsonAuthor Commented:
This is the final script I think this will do it thanks for your help Jorge_toriz

select a.Name, a.Originating_Server, a.Job_id, b.Step_Name, b.Sql_Severity, b.[Message] from msdb.dbo.sysjobs_view a, msdb.dbo.sysjobhistory b
where a.job_id=b.job_id and message like'%failed%'
0
 
Steve SamsonAuthor Commented:
Some times it helps to look out side of the imediate problem to find a solution.
0
 
jorge_torizResearch & Development ManagerCommented:
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.