Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top