Jump to content

Recommended Posts

Posted

It would be nice with a build in option to trigger notifications based on failed Agent Jobs.

We are currently using this custom SQL Query in 'msdb':

SELECT STUFF((SELECT N', ' + name FROM (SELECT name FROM dbo.sysjobs WHERE (SELECT TOP 1 run_status FROM dbo.sysjobhistory WHERE (step_id = 0) AND (job_id = sysjobs.job_id) ORDER BY run_date DESC, run_time DESC) = 0 AND (enabled = 1)) AS [n1] FOR XML PATH(''),TYPE).value('text()[1]','nvarchar(max)'),1,2,N'') AS [Failed]

// Martin.

  • 8 months later...
Posted

Any status?

The following SQL script shows all failed (and enabled) agent jobs:

SELECT        name
FROM            msdb.dbo.sysjobs
WHERE        ((SELECT        TOP (1) run_status
                            FROM            dbo.sysjobhistory
                            WHERE        (step_id = 0) AND (job_id = dbo.sysjobs.job_id)
                            ORDER BY run_date DESC, run_time DESC) = 0) AND (enabled = 1)

 

  • Administrators
Posted

Hi Martin,

Thanks. I've pushed this into our todo list. It will be picked by the development team and we'll notify you when this is implemented.

-Paul

  • 1 year later...
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...