How to perform a row lock?

后端 未结 4 915
悲哀的现实
悲哀的现实 2020-12-10 06:42

I want to lock one record and then no one may make changes to that record. When I release the lock, then people may change the record.

In the meantime that a record

4条回答
  •  时光说笑
    2020-12-10 07:05

    Sql Server has locking hints, but these are limited to the scope of a query.

    If the decision to lock the record is taken in an application, you can use the same mechanisms as optimistic locking and deny any changes to the record from the application.

    Use a timestamp or guid as a lock on the record and deny access or changes to the record if the wrong locking key is given. Be careful to unlock records again or you will get orphans

提交回复
热议问题