Wednesday, March 7, 2012

SQL SERVER TSQL Repeatable Read isolation level

The Repeatable Read isolation level allows a transaction to acquire read locks on all rows of data it returns to an application,
and write locks on all rows of data it inserts, updates, or deletes.

By using the Repeatable Read isolation level, SELECT SQL statements issued multiple times within the same transaction will always yield the same result.
 A transaction using the Repeatable Read isolation level can retrieve and manipulate the same rows of data as many times as needed until it completes its task.

However, no other transaction can insert, update, or delete a row of data that would affect the result table being accessed, until the isolating transaction releases its locks. That is, when the isolating transaction is either committed or rolled back.

Transactions using the Repeatable Read isolation level wait until rows of data that are write-locked by other transactions are unlocked before they acquire their own locks.


This prevents them from reading "dirty" data. In addition, because other transactions cannot update or delete rows of data that are locked by a transaction using the Repeatable Read isolation level, nonrepeatable read situations are avoided.

No comments:

Post a Comment