You are a database developer. You plan to design a database solution by using SQL Server 2008. A stored procedure in a database uses a transaction to retrieve data from a table and produces aggregations. You must design a solution that meets the following requirements:
* Update operations cannot be performed on the retrieved data while the stored procedure is being executed.
* Insert operations in the table can be performed while the stored procedure is being executed.
You need to ensure that the solution meets the requirements. What isolation level should you use?
A.
SERIALIZABLE
B.
READ COMMITTED
C.
REPEATABLE READ
D.
READ UNCOMMITTED
Explanation:
REPEATABLE READSpecifies that statements cannot read data that has been modified but not yet committed by other transactions and that no other transactions can modify data that has been read by the current transaction until the current transaction completes.
Shared locks are placed on all data read by each statement in the transaction and are held until the transaction completes. This prevents other transactions from modifying any rows that have been read by the current transaction. Other transactions can insert new rows that match the search conditions of statements issued by the current transaction. If the current transaction then retries the statement it will retrieve the new rows, which results in phantom reads. Because shared locks are held to the end of a transaction instead of being released at the end of each statement, concurrency is lower than the default READ COMMITTED isolation level. Use this option only when necessary.