What is the default transaction isolation level for SQL Server with ADO.NET?
Sql Server-2008Transactionsado.netSql Server-2008 Problem Overview
What is the default transaction isolation level for SQL Server with ADO.NET? I am using a default installation of SQL Server and just the normal System.Data.SqlClient classes.
Sql Server-2008 Solutions
Solution 1 - Sql Server-2008
> READ COMMITTED is the default isolation level for the Microsoft SQL Server Database Engine.
Source:
Here is how it compares to other isolation levels:
The MSDN documentation for SqlConnection.BeginTransaction()
also states Read committed
> ... To reset the isolation level to the default (READ COMMITTED) ...
Solution 2 - Sql Server-2008
The accepted answer by hkf gives the correct answer for transactions started manually with SqlConnection.BeginTransaction()
. Here, the default level is ReadCommitted.
However, this is not the only way to start a new transaction in ADO.NET: Transactions can also be created automatically by using the classes from the System.Transactions
namespace, in particular, by creating a TransactionScope
.
Contrary to transactions started manually, transactions created by the System.Transactions
infrastructure (and, thus, by a TransactionScope
) are Serializable.
See below link for more information: