Listare operatori sql

Configurare noua (How To)

Situatie

Mai jos este o procedura ce returneaza lista operatorilor de pe un server de sql precum si joburile unde acesti operatori sunt asignati.

Solutie

create procedure ListOperatorsAndJobs_prc

as

SELECT o.[id]
,o.[name] AS Operator
,CASE WHEN o.[enabled] =1 THEN ‘YES’ ELSE ‘NO’ END AS OperatorEnabled
,o.[email_address]
,o.[last_email_date]
,o.[last_email_time]
,CASE WHEN j.[enabled] =1 THEN ‘YES’ ELSE ‘NO’ END AS JobEnabled
,j.[name] AS JobName
,j.[description] AS JobDescription

FROM
[msdb].[dbo].[sysoperators] o INNER JOIN
[msdb].[dbo].[sysjobs_view] j ON o.[id] = j.[notify_email_operator_id]

WHERE
j.[notify_email_operator_id] <> 0

Tip solutie

Permanent
Etichetare:

Voteaza

(14 din 27 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?