Wednesday, 3 March 2010

Operator in SQL Server 2005

--*************************************--
-- ALL About Operator --
--*************************************--
-- ADD or Create New Operator
USE [msdb]
GO
EXEC msdb.dbo.sp_add_operator @name=N'Dbmail',
@enabled=1,
@pager_days=0,
@email_address=N'testmailfromdb@domin.com',
@pager_address=N'',
@netsend_address=N''
GO

-- UPDATE operator
USE [msdb]
GO
EXECUTE msdb.dbo.sp_update_operator @name = 'Dbmail',
@email_address = 'testmailfromdb2@domin.com'
GO

-- DELETE operator with the same name.
EXECUTE msdb.dbo.sp_delete_operator @name = N'Dbmail'

-- To DISABLE the operator
EXEC msdb.dbo.sp_update_operator @name=N'Dbmail',
@enabled=0

-- To ENABLE the operator
EXEC msdb.dbo.sp_update_operator @name=N'Dbmail',
@enabled=1

No comments:

Post a Comment