Reputation:
I read article from this link https://msdn.microsoft.com/en-us/library/ms189823.aspx
One thing I don't understand clearly the differences between the @LockMode=Shared, Update, IntentShared, IntentExclusive, or Exclusive.
Upvotes: 5
Views: 1068
Reputation: 9391
Depending on the lock mode you take, other transactions using the same resource can either aquire a lock or not. The meaning of the locks and their effect on other lock takers are described here: SQL Server lock compatibility matrix.
Short version:
Shared
(aka "Read"): Lets others take Shared locks, too but prevents Exclusive locks from being taken.Update
: Only one transaction at a time can have an Update lock. Others can take Shared locks. Exclusive locks are prevented.Exclusive
: What it says on the label. Every other lock is prevented.Intent ...
: Not very useful mode for an application lock. These come from resource hierarchies like index trees and mean that you don't wish to lock the actual resource but one dependent from it (which may or may not lead to a change on the intent locked resource).Upvotes: 7