Executing an SQLCommand without specifying a Transaction

sql-server, sqlcommand, transactions

Solution

SQL Server can work happily without an explicit transaction. But yes, I believe it is essentially read-committed (unless, of course, you add extra hints to your query objects,such as `UPDLOCK` / `NOLOCK`). You can investigate this with:

DBCC USEROPTIONS

which shows (among others):

isolation level read committed

Problem

We have some lists of data being fetched in our application via a SqlCommand performing a `SELECT` query on a SQL Server database. We do not explicitly setup a transaction on the SqlCommand, instead just passing it a SqlConnection and running it. Is it the case that when no transaction is specified that SQL Server will initiate and use a default transaction with the default IsolationLevel of `ReadCommitted`?

Original source