How to exclusively lock a row that prevent CRUD operation

前端 未结 5 1913
無奈伤痛
無奈伤痛 2021-01-11 15:56

Hi expert how I can lock a row in sql server that prevent CRUD operation even SELECT. Is it Possible? Serializable Isolation level does not prevent SELECT. thanks

5条回答
  •  轮回少年
    2021-01-11 16:32

    As well as ROWLOCK, XLOCK as suggested by other folk, I would consider READPAST in addition

    This allows allows other readers and writers to skip the lock on this row. This can increase concurrency because the lock set by ROWLOCK, XLOCK s blocking otherwise

提交回复
热议问题