3

Is there a good way to query sql agent jobs for success / failure notification to a given operator name? One of the operators is no longer with the company and need to fix up all agent jobs sending failure notifications to that person.

1 Answer 1

3

Please try following T-SQL query:

 USE [msdb]
GO

   SELECT j.[name] AS [JobName]
    FROM [dbo].[sysjobs] j
    LEFT JOIN [dbo].[sysoperators] o ON (j.[notify_email_operator_id] =o.[id] )
    WHERE o.[id]=1 ----or o.[name]='your operator name'
     and j.[enabled] = 1 
        AND j.[notify_level_email] IN (1,2)

This should be able to query the jobs for success or failure notification to a specified operator.

1
  • please don't add links to other sites that are unrelated to the question and answer presented here. And if you do add links, make sure your answer contains the relevant parts of the linked post.
    – Hannah Vernon
    Dec 9, 2020 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.