--------------------------------------------------------------------------------
--  File        :   Demo 03_ProcessB.sql
--
--  Purpose     :   This script is half of a demonstration of creating a 
--                  deadlock.  Open this script in one window of Query 
--                  Analyzer and the "Demo 03_ProcessA.sql" script in another 
--                  window.
--
--                  NOTE: This code is based on an example from:
--                      "Finding and troubleshooting SQL Server deadlocks" <http://www.mssqltips.com/tip.asp?tip=1036>
--
--                  NOTE: This script depends on the [Northwind] database, 
--                  which can be downloaded from:
--                      "Northwind and pubs Sample Databases for SQL Server 2000" <http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&displaylang=en>
--
--  SQL Server  :   SQL Server 2000 (8.0)
--
--  Version     :   3.0006.0080.0027 (2010-10-25)
--------------------------------------------------------------------------------

/*  Instructions  */

--  1.  Open the "Demo 03_ProcessA.sql" script in one window of Query Analyzer.
--  2.  Open this script in another window.
--  3.  Execute the "Demo 03_ProcessA.sql" script without selecting any of the 
--      code.
--  4.  Execute this script without selecting any of the code.
--  5.  In the first window, select/highlight the text in lines 48 through 49.
--  6.  Press the F5 button to execute the selected code.
--  7.  Wait for the this script to be chosen as the deadlock victim.
--  8.  In the first window, select/highlight the text in line 53.
--  9.  Press the F5 button to execute the selected code.

USE [Northwind];

GO

BEGIN TRANSACTION;

UPDATE [Employees]
SET [FirstName] = 'Bob';

UPDATE [Products]
SET [SupplierID] = 1;

/*
ROLLBACK TRANSACTION;
*/

GO
