1

I am using SQL Server 2008 R2 and I want to create a script of my jobs.

I need to find all objects that exist in one job.

To achieve this goal, I get all operators with this query:

SELECT * FROM msdb.dbo.sysoperators

and I can find all Alerts with this query:

SELECT * FROM msdb.dbo.sysalerts

Each alert has several operators.

I want to join the two tables together.

  • How can I get all operators for all alerts?
2

You can use this query:

SELECT * 
FROM msdb.dbo.sysalerts AS Ale
INNER JOIN msdb.dbo.sysnotifications AS Noti ON Ale.id = Noti.alert_id
INNER JOIN msdb.dbo.sysoperators AS Ope ON Noti.operator_id = ope.id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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