Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7984499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:17:22+00:00 2026-06-04T11:17:22+00:00

I want to get the failed jobs which sql server agent failed to start

  • 0

I want to get the failed jobs which sql server agent failed to start or run through sql script…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:17:23+00:00Added an answer on June 4, 2026 at 11:17 am

    I created a view to obtain the failed jobs in sql server

    CREATE VIEW dbo.View_Failed_Jobs
        AS
        SELECT   Job.instance_id
            ,SysJobs.job_id
            ,SysJobs.name as 'JOB_NAME'
            ,SysJobSteps.step_name as 'STEP_NAME'
            ,Job.run_status
            ,Job.sql_message_id
            ,Job.sql_severity
            ,Job.message
            ,Job.exec_date
            ,Job.run_duration
            ,Job.server
            ,SysJobSteps.output_file_name
        FROM    (SELECT Instance.instance_id
            ,DBSysJobHistory.job_id
            ,DBSysJobHistory.step_id
            ,DBSysJobHistory.sql_message_id
            ,DBSysJobHistory.sql_severity
            ,DBSysJobHistory.message
            ,(CASE DBSysJobHistory.run_status
                WHEN 0 THEN 'Failed'
                WHEN 1 THEN 'Succeeded'
                WHEN 2 THEN 'Retry'
                WHEN 3 THEN 'Canceled'
                WHEN 4 THEN 'In progress'
            END) as run_status
            ,((SUBSTRING(CAST(DBSysJobHistory.run_date AS VARCHAR(8)), 5, 2) + '/'
            + SUBSTRING(CAST(DBSysJobHistory.run_date AS VARCHAR(8)), 7, 2) + '/'
            + SUBSTRING(CAST(DBSysJobHistory.run_date AS VARCHAR(8)), 1, 4) + ' '
            + SUBSTRING((REPLICATE('0',6-LEN(CAST(DBSysJobHistory.run_time AS varchar)))
            + CAST(DBSysJobHistory.run_time AS VARCHAR)), 1, 2) + ':'
            + SUBSTRING((REPLICATE('0',6-LEN(CAST(DBSysJobHistory.run_time AS VARCHAR)))
            + CAST(DBSysJobHistory.run_time AS VARCHAR)), 3, 2) + ':'
            + SUBSTRING((REPLICATE('0',6-LEN(CAST(DBSysJobHistory.run_time as varchar)))
            + CAST(DBSysJobHistory.run_time AS VARCHAR)), 5, 2))) AS 'exec_date'
            ,DBSysJobHistory.run_duration
            ,DBSysJobHistory.retries_attempted
            ,DBSysJobHistory.server
            FROM msdb.dbo.sysjobhistory DBSysJobHistory
            JOIN (SELECT DBSysJobHistory.job_id
                ,DBSysJobHistory.step_id
                ,MAX(DBSysJobHistory.instance_id) as instance_id
                FROM msdb.dbo.sysjobhistory DBSysJobHistory
                GROUP BY DBSysJobHistory.job_id
                ,DBSysJobHistory.step_id
                ) AS Instance ON DBSysJobHistory.instance_id = Instance.instance_id
            WHERE DBSysJobHistory.run_status <> 1
            ) AS Job
        JOIN msdb.dbo.sysjobs SysJobs
           ON (Job.job_id = SysJobs.job_id)
        JOIN msdb.dbo.sysjobsteps SysJobSteps
           ON (Job.job_id = SysJobSteps.job_id AND Job.step_id = SysJobSteps.step_id)
        GO
    

    — Now execute the select statement to query the failed jobs

    Select * from View_Failed_Jobs
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I want to get PHUnit up so I can run selenium server, but
I want to get list which computers are online or offline on local network
I create one cursor now i want to call that cursor in sql server
hi i am using SQL Server 2008, want to create a view to list
I want get the time used for a case so I can create an
I want get all of the Geom objects that are related to a certain
I want get as much as possible from Redis + Hiredis + libevent. I'm
I just want get a 2 dimension array of List in c#. In my
I want to get the top #nr_of_rows - (int)(#nr_of_rows / 10 - 1) of
I want to get myself into programming some serious GUI based applications, but when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.