Wednesday, September 25, 2013

Update job notification

 

Following Query will update the Existing job name starts with ‘WIN%’ as on complete to notify the email operator 'SQLDBASupport'

select
'EXEC msdb.dbo.sp_update_job @job_name=N'+CHAR(39)+name+CHAR(39)
+' ,
        @notify_level_email=3,
        @notify_level_netsend=2,
        @notify_level_page=2,
        @notify_email_operator_name=N'+char(39)+'SQLDBASupport'+char(39)
from msdb.dbo.sysjobs
where name like 'WIN%'
and notify_email_operator_id =0