3961: Snapshot isolation transaction failed because the object was modified by a DDL statement
SQL ServerWhat does it mean?
A transaction running at snapshot isolation failed because an object it accessed was changed by a DDL statement (schema change) in another concurrent transaction. Metadata is not versioned, so the snapshot transaction cannot continue.
Why does it happen?
While a transaction started at SNAPSHOT isolation (SET TRANSACTION ISOLATION LEVEL SNAPSHOT) is running, another session runs DDL such as ALTER TABLE/CREATE INDEX on a table it accesses. Snapshot transactions can see row versions but not schema versions. This error does not occur under READ COMMITTED SNAPSHOT (RCSI); RCSI takes a new snapshot for each statement.
How to fix it
Retry the transaction; it usually succeeds once the DDL has completed. As a permanent fix, perform schema changes (DDL) in maintenance windows without heavy snapshot workload. Catch this error in the application and implement automatic retry logic. Shorten long-running snapshot transactions.
More from this engine
- 3902The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION
- 1101Could not allocate a new page because of insufficient disk space in filegroup
- 3729Cannot DROP because it is being referenced by object
- 1785Introducing FOREIGN KEY constraint may cause cycles or multiple cascade paths
- 9421XML parsing: illegal xml character
- 15151Cannot find the object/principal because it does not exist or you do not have permission
- 4834You do not have permission to use the bulk load statement