MARK PONGONIS · Aug 27, 2018

Cache SQL Lock at record level

Is there a way to lock at the record level? I know that you can lock at the table level:


but am unable to find a way to lock just at the record/row level. 

Would this also affect a SELECT statement done on the record?

1 0 1 270
Log in or sign up to continue

You can achieve this using TRANSACTIONS in combination with ISOLATION LEVELS

BUT: as with the  LOCK in COS you depend on the other players to take notice of your isolation.  
If they don't care you are lost since this is no absolute locking.
COS has the option to lock your record ahead - but you depend on the other participants.

An other option is to use ROWVERSION  to protect your record. (optimistic locking)
If someone has changed your record under cover you get alerted on the fact.