views:

42

answers:

2

How can I set the isolation level of all my SqlCommand ExecuteNonQuery calls to be read uncommitted? (connecting to a SQL Server 2008 enterprise instance)

I am simply transforming static data and inserting the results to my own tables on a regular basis, and would like to avoid writing more code than necessary.

A: 
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
BEGIN TRAN
/* do stuff */
COMMIT
Zugwalt
This isn't what I asked - I understand how to do it in SQL, but I have many pre-canned statements that need to run from a C# app, so I would like to set the isolation-level in code
Jeff Meatball Yang
+1  A: 

No, you cannot.

You can define a default transaction isolation level on a per-database level, but then this applies to all users and all applications using that database.

Or you need to explicitly define the isolation level when you start a transaction.

For more info on adjusting the isolation level, see the MSDN documentation on the topic.

marc_s