Displaying active locks

If an attempt to write to a table fails because another transaction holds a lock on that table, you see a message like this one:

Cannot open the requested object for write in the current transaction (TxnID1). Another user has write access in transaction TxnID2.

To identify the user who has that table locked, use the sp_iqtransaction procedure. Find TxnID2 in the output of sp_iqtransaction, and look for the name of the user in the same row of output.

The sp_iqlocks procedure displays information about locks currently held in the database. For each lock in the catalog store and the IQ Store of your current database, sp_iqlocks tells you:

For syntax details and sample output, see “sp_iqlocks procedure” in Chapter 7, “System Procedures,” in Reference: Building Blocks, Tables, and Procedures.

The sp_iqtransaction procedure provides more detailed information about transactions.