Locking in SQL Server :-

Locking resolves of concurrent access where concurrent access means accessing same data by the number of users at same time.

The following problem occurs concurrent  access:

  1. dirty read
  2. last update

Locks types are Two types:

  1. Shared lock ->   It is denoted by (‘s’)
  2. exclusive lock ->  it is denoted by ‘x’
  • Shared lock is placed when ever user to trying read the database. [i:e select]
  • Exclusive lock is placed when ever you have to trying update the  database [i:e update]
  • Update lock (u):This lock is placed when ever user is try to update the database item but this is placed before placing exclusive lock.