Skip to main content

How to use deadlock priority

Deadlock priority 

The deadlock priority setting will let you control how important you code is in the event of a deadlock.

 The priority is low, medium and high.

When a deadlock occurs, SQL Server will rollback the cheapest transaction. 

The DEADLOCK PRIORITY is placed right before the BEGIN TRAN clause.

SET DEADLOCK PRIORITY LOW
BEGIN TRAN
   -- Do your stuff here
COMMIT TRAN

This snippet will be rollbacked if it's involved in a deadlock.

sql, sqlserver, storedprocedures, development

  • Hits: 777