Listare operatori pe serverul de sql

Configurare noua (How To)

Situatie

Am facut o procedura ce returneaza operatorii setati pe serverul de sql si, pentru fiecare operator in parte, returneaza jobul\joburile de sql la care este alocat si ultima data cand operatorul a fost notificat prim email.

Solutie

CREATE PROCEDURE BD_OperatorsJobs_prc

as

SELECT
so.[id]
,so.[name] AS Operator
,CASE WHEN so.[enabled] =1 THEN ‘YES’ ELSE ‘NO’ END AS OperatorEnabled
,so.[email_address]
,so.[last_email_date]
,so.[last_email_time]
,CASE WHEN sj.[enabled] =1 THEN ‘YES’ ELSE ‘NO’ END AS JobEnabled
,sj.[name] AS JobName
,sj.[description] AS JobDescription
FROM
[msdb].[dbo].[sysoperators] so INNER JOIN
[msdb].[dbo].[sysjobs_view] sj ON so.[id] = sj.[notify_email_operator_id]
WHERE
sj.[notify_email_operator_id] <> 0

Tip solutie

Permanent
Etichetare:

Voteaza

(20 din 50 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?