--------------------------------------------------------------------------------
--  File        :   Configure error 1205 for logging,2000.sql
--
--  Purpose     :   This script configures SQL Server to write the deadlock 
--                  error message (1205) to the SQL Server error log and the 
--                  Windows application event log each time that it is raised.
--
--                  See "sp_altermessage" <http://msdn.microsoft.com/en-us/library/aa259612(SQL.80).aspx> 
--                  for more information.
--
--                  NOTE: To undo the change, run the following T-SQL:
--
--                      EXECUTE [master].[dbo].[sp_altermessage]
--                          @message_id = 1205,
--                          @parameter = 'WITH_LOG',
--                          @parameter_value = 'false';
--
--  SQL Server  :   SQL Server 2000 (8.0)
--
--  Version     :   3.0009.0080.0000 (2012-05-10)
--------------------------------------------------------------------------------

USE [tempdb];

GO

--  First, display the 1205 error message record before any changes have been 
--  made.
SELECT [error],
    [severity],
    [dlevel],
    [description]
FROM [master].[dbo].[sysmessages]
WHERE ([error] = 1205);

--  Change the error message so that it is always logged.
EXECUTE [master].[dbo].[sp_altermessage]
    @message_id = 1205,
    @parameter = 'WITH_LOG',
    @parameter_value = 'true';

--  Finally, display the 1205 error message record after the change has been 
--  made.
SELECT [error],
    [severity],
    [dlevel],
    [description]
FROM [master].[dbo].[sysmessages]
WHERE ([error] = 1205);

GO
