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:

  • Granularity: rowlock , paglock , tablock
  • Lock type: nolock , updlock , xlock
  • Other hints: 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.

    链接地址: http://www.djcxy.com/p/32880.html

    上一篇: SQL Server插入锁定与并发事务

    下一篇: xlock,rowlock,holdlock是否正确?