Job Notification Email

  • I would like to know that every job has an onfail email sent to the SQL DBA group.

    Something like:

    select @@Servername,Job_name,email_address

    from (system job tables)

    Any scripts or clues out there?

    select @@servername,getdate(),id,name,email_address

    from msdb.dbo.sysoperators

    where enabled=1 and email_address like 'sql.dba%'

    The above works but how does this table link to msdb.dbo.sysnotifications and what other tables are required?

    Thanks

  • This did the task:

    select ' ',@@servername,b.name,a.name,

    email_address,

    case a.[enabled]

    when '1' then 'Enabled'

    when '0' then 'Disabled *****'

    end, ' '

    from msdb.dbo.sysoperators a inner join msdb..sysjobs b

    on a.[id] = b.[notify_email_operator_id]

    where email_address not like 'sql.dba%'

    Formatted for some HTML style output.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply