SQL Server: how to simulate and catch deadlock
SQL Server Profiler has the template "locks" that is intended especially to trace deadlock. Let's try to simulate and catch a deadlock situation.
Suppose the test database is named test
. Create two tables and feed them some data.
USE test;
CREATE TABLE dbo.invoices (
id int NOT NULL,
num nvarchar …