![]() | ![]() |
Home |
|
|
Transact-SQL User's Guide |
|
| Chapter 19 Locking Commands and Options |
|
| Readpast locking for queue processing |
|
| Effects of isolation levels select queries with readpast |
Readpast locking is designed to be used at transaction isolation level 1 or 2.
Session-level transaction isolation levels and readpastFor data-only-locked tables, the effects of readpast on a table in a select command are shown in Table 19-1.
Session Isolation Level | Effects |
0, read uncommitted (dirty reads) | readpast is ignored, and rows containing uncommitted transactions are returned to the user. A warning message is printed. |
1, read committed | Rows or pages with incompatible locks are skipped; no locks are held on the rows or pages read. |
2, repeatable read | Rows or pages with incompatible locks skipped; shared locks are held on all rows or pages that are read until the end of the statement or transaction. |
3, serializable | readpast is ignored, and the command executes at level 3. The command blocks on any rows or pages with incompatible locks. |
If select commands that specify readpast also include any of the following clauses, the commands fail and display error messages:
The at isolation clause, specifying 0 or read uncommitted
The at isolation clause, specifying 3 or serializable
The holdlock keyword on the same table
If a select query that specifies readpast also specifies at isolation 2 or at isolation repeatable read, shared locks are held on the readpast table or tables until the statement or transaction completes.
readtext commands that include readpast and that specify at isolation read uncommitted automatically run at isolation level 0 after issuing a warning message.
|
|