Cannot Write to a Locked Table

Locked tables may cause issues.

Possible Causes

The following error message is reported when writing to an object to which another user already has write access. Cannot open the requested object for write in the current transaction (TxnID1). Another user has write access in transaction TxnID2.

Action

Use the sp_iqlocks stored procedure to identify users who are blocking other users from writing to a table. This procedure displays information about locks currently held in the database, including the connection and user ID that holds the lock, the table on which the lock is held, the type of lock, and a name to identify the lock.

The error message also includes the transaction ID of the user who is attempting to write (TxnID1)and the transaction ID of the user who is currently writing (TxnID2). If you need more detailed information about the transaction that has locked the table, run the sp_iqtransaction stored procedure.

Related concepts
How Locking Works
Interactive SQL
Managing Write Lock Contention on a Table