Understanding Isolation Levels in Transaction
page 2 of 6
by SANJIT SIL
Feedback
Average Rating: 
Views (Total / Last 10 Days): 27154/ 44

How to Set the Transaction Isolation Level

In SQL server stored procedure, we can set the isolation level using the SET TRANSACTION ISOLATION LEVEL command. In Listing 1 it is described. In ADO.NET the isolation level can be set by creating the transaction using an overload of the BeginTransaction() method of the Command or by setting the Isolation Level property of an existing Transaction object. In Listing 2 it is described.

Listing 1

SET TRANSACTION ISOLATION LEVEL REPEATABLE READ
GO
BEGIN TRANSACTION
SELECT * FROM emp
SELECT * FROM dept 
...
COMMIT TRANSACTION

Listing 2

myTransaction =myConnection.BeginTransaction(IsolationLevel.ReadUncommitted);

In the above code listing we can also specify SERIALIZABLE, READ COMMITTED and READ UNCOMMITTED like REPEATABLE READ. Only one of the options can be set at a time and it remains set for that connection until we change it explicitly.


View Entire Article

User Comments

No comments posted yet.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-20 2:24:56 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search