// SQL Server error reference

SQL Server error 3960: Snapshot isolation update conflict

Under SNAPSHOT isolation, this transaction tried to change a row another transaction changed after this one started. Retry the transaction.

Error number
3960
Severity
16
Category
Transactions and locking
Error message
Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation to access table '%.*ls' directly or indirectly in database '%.*ls' to update, delete, or insert the row that has been modified or deleted by another transaction. Retry the transaction or change the isolation level for the update/delete statement.

What it means

A transaction at SNAPSHOT isolation reads data as it was when the transaction started. If it then updates or deletes a row that another transaction has modified and committed since then, SQL Server can't apply the change without losing the other update, so it rolls the transaction back with 3960. This is optimistic concurrency working as designed. Read committed snapshot isolation (RCSI) doesn't raise 3960; only the SNAPSHOT level does.

Common causes

  • Two SNAPSHOT transactions updating the same row concurrently.
  • A long SNAPSHOT transaction that reads, waits, then writes rows that others are actively changing.

How to fix it

  1. Retry the whole transaction; it will see the newer data the second time.

  2. Keep snapshot transactions short, especially between the read and the write.

  3. For hot rows, take an update lock when reading so the conflict becomes a short wait instead of a rollback.

    SELECT Balance FROM dbo.Accounts WITH (UPDLOCK) WHERE AccountId = 1;

Related errors

More transactions and locking errors

The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.

// fewer errors, faster fixes

Work on SQL Server in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.