Is xlock,rowlock,holdlock correct?
I saw the combination of (xlock,rowlock,holdlock) is used for a table. Refer to online book, holdlock is to hold shared lock(for read,such as select) until transaction is done and xlock is exclusive lock(write lock) for data modification, such as update, insert or delete. How could we use read and write a table at the same time? I am wondering if the combination take effect or not. Confusing...
Locking hints come in various types:
rowlock
, paglock
, tablock
nolock
, updlock
, xlock
holdlock
, readpast
, nowait
The combination you suggest is xlock, rowlock, holdlock
. Those three do not conflict. It'll lead to an exclusive rowlock that is held until the end of the transaction.
上一篇: SQL Server插入锁定与并发事务