Deadlock can be detected and resolved automatically without manual intervention in SQL Server. This article will help to configure extended events using GUI to capture deadlocks data.
Below code will help you to reproduce deadlock:
— Create table 1 in the database
CREATE TABLE [dbo].[syn_st](
[na] [varchar](10) NULL,
[nom] [int] NULL
) ON [PRIMARY]
— — Create table 2 in the database
CREATE TABLE [dbo].[syn_st1](
[na] [varchar](10) NULL,
[nom] [int] NULL
) ON [PRIMARY]
— populate 1 or 2 records into both tables
—Step 1 in session 1
begin tran
update syn_st set nom = 1224 where nom = 1225
—Step 2 in session 2
begin tran
update syn_st1 set nom = 1224 where nom = 1225
—Step 3 in session 1
update syn_st1 set nom = 1224 where nom = 1225
— step 4 in session 2
update syn_st set nom = 1224 where nom = 1225