Locking in SQL server

Locking in SQL server:

There are two types of locks in SQL server:
Read Lock - The locked data is reserved for read by the current session. Other sessions can read the locked data. But they can not write (update) the locked data. A read lock is also called a shared lock.
Write Lock - The locked data is reserved for write by the current session. Other sessions can not read and write the locked data. A write lock is also called an exclusive lock.

There are three levels of locks:
Table Lock - The lock is set at the table level. All rows in the locked table are locked.
Row Lock - The lock is set at the row level. Some rows of a table are locked. But other rows are not locked.
Column Lock - The lock is set at the column level. Some columns of a row are locked. But other columns are not locked.

0 comments:

Post a Comment

Blogger news