--------------------------------------------------------------------------------
--  File        :   Demo 05_Enable the trace flags for recording deadlock information in the error log,2000.sql
--
--  Purpose     :   This script configures SQL Server to write the deadlock 
--                  information to the SQL Server error log each time that a 
--                  deadlock occurs.
--
--                  See "SQL Server technical bulletin - How to resolve a deadlock" <http://support.microsoft.com/default.aspx?scid=kb;en-us;832524>
--                  for more information.
--
--                  NOTE: To undo the change, run the following T-SQL:
--
--                      DBCC TRACEOFF
--                      (
--                          3605,
--                          1204,
--                          -1
--                      );
--
--                  NOTE: This setting will be lost when the instance is 
--                  restarted.  Trace flags can also be configured as startup 
--                  options.  See "Using Startup Options" <http://msdn.microsoft.com/en-us/library/aa213799(SQL.80).aspx> 
--                  for more information.
--
--                  NOTE: This script will also work for SQL Server versions 
--                  2005 and 2008, however, trace flag 1222 is far superior, 
--                  so one should the 
--                  "Enable the trace flags for recording deadlock information in the error log,2005+.sql" 
--                  script instead.
--
--  SQL Server  :   SQL Server 2000 (8.0)
--
--  Version     :   3.0006.0080.0027 (2010-10-25)
--------------------------------------------------------------------------------

USE [tempdb];

GO

DBCC TRACEON
(
    3605,   --  Dump the output of trace flag 1204 in the error log
    1204,   --  Provide run-time information about deadlocks
    -1      --  Apply to all sessions/connections
);

--  To turn off the trace flag, select and run the following code.
/*
DBCC TRACEOFF
(
    3605,
    1204,
    -1
);
*/

GO
