USE [msdb]
GO

-- delete operator
IF  EXISTS (SELECT name FROM msdb.dbo.sysoperators WHERE name = N'DBA operator')
EXEC msdb.dbo.sp_delete_operator @name=N'DBA operator'
GO

USE [msdb]
GO

-- Create operator
EXEC msdb.dbo.sp_add_operator @name=N'DBA operator', 
		@enabled=1, 
		@weekday_pager_start_time=90000, 
		@weekday_pager_end_time=180000, 
		@saturday_pager_start_time=90000, 
		@saturday_pager_end_time=180000, 
		@sunday_pager_start_time=90000, 
		@sunday_pager_end_time=180000, 
		@pager_days=0, 
		@email_address=N'Gal_SE_DBA@galenica.com', 
		@category_name=N'[Uncategorized]'
GO


USE [msdb]
GO

-- delete Alerte
IF  EXISTS (SELECT name FROM msdb.dbo.sysalerts WHERE name = N'DBA - Broker - Too many messages in queue')
EXEC msdb.dbo.sp_delete_alert @name=N'DBA - Broker - Too many messages in queue'
GO

USE [msdb]
GO

-- create alert
EXEC msdb.dbo.sp_add_alert @name=N'DBA - Broker - Too many messages in queue', 
		@message_id=0, 
		@severity=0, 
		@enabled=1, 
		@delay_between_responses=900, 
		@include_event_description_in=1, 
		@category_name=N'[Uncategorized]', 
		@performance_condition=N'MSSQL$APSSQL:Broker Statistics|Enqueued Messages Total||>|50', 
		@job_id=N'00000000-0000-0000-0000-000000000000'
GO