In SQL Server, deadlock occurs because two or more processes are waiting for each other's reserved locked resources, resulting in a situation where the jobs are permanently blocked from each other. When a deadlock occurs, SQL Server will choose one of the jobs as the victim, and end its transaction with an error. as follows.
Generally speaking, the DBA will enable and set the trace flag (1222) to collect deadlock information in order to analyze the occurrence of deadlock. Another method is to use the extended events (Extended Events) system_health session (Sessions) to query the cause of the deadlock. as follows.
Click xml, you can find the reason for the deadlock.