Friday, 13 April 2012

How to associate all jobs to an operator ( base on their Job ID)

SQL : associate all jobs to an operator ( base on their Job ID)

use msdb
go


SELECT name ,
sql = '
EXEC msdb.dbo.sp_update_job @job_id=N''' +  convert(varchar(200), job_ID ) + ''',
              @notify_level_email=2,
              @notify_level_netsend=2,
              @notify_level_page=2,
              @notify_email_operator_name=N''SQLServerAlertMaint''

              go

              '

FROM dbo.sysjobs
order by  name
--WHERE program_name like 'SQLAgent - TSQL JobStep%'


No comments:

Post a Comment