Alert

USE [msdb]
GO

EXEC msdb.dbo.sp_add_alert @name=N'1205 - Deadlock Detected', 
		@message_id=1205, 
		@severity=0, 
		@enabled=1, 
		@delay_between_responses=0, 
		@include_event_description_in=1, 
		@category_name=N'[Uncategorized]', 
		@job_id=N'00000000-0000-0000-0000-000000000000'
GO

Log

EXEC sp_altermessage 1205, 'WITH_LOG', 'true'
Trace Flags 1204 and 1222

DBCC TRACEON(1222,-1) ;
DBCC TRACEOFF(<Flag_Number>,-1) ;

select * from [dbo].[CatchDeadLock]

--truncate table [CatchDeadLock]
Last modified: June 14, 2021

Author

Comments

Write a Reply or Comment