Monday, March 11, 2013

SQL Agent Job Failure Notification Setup


select
name,
'/*'
+ name
+'*/      '
+'EXEC msdb.dbo.sp_update_job @job_id=N'
+ '''' +
cast(job_id as varchar(255))
+ '''' +
',
              @notify_level_email=2,
              @notify_level_netsend=2,
              @notify_level_page=2,
              @notify_email_operator_name=N''EC-DBAs'''
from msdb.dbo.sysjobs
where enabled = 1
and notify_level_email = 0
--and name like 'basic%'
order by name