Jump to content

Agent job staus in SQL server module


Recommended Posts

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.

Link to comment
Share on other sites

  • 8 months later...
  • 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...