Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server snapshot isolation level issue

I am studying snapshot isolation level of SQL Server 2008 from the below link. My confusion is,

http://msdn.microsoft.com/en-us/library/ms173763.aspx

  1. It is mentioned "Data modifications made by other transactions after the start of the current transaction are not visible to statements executing in the current transaction." -- seems data committed by other transactions are not visible to the current snapshot isolation level transaction;

  2. It is mentioned "A transaction running under SNAPSHOT isolation level can view changes made by that transaction." -- seems data committed by other transactions are visible to the current snapshot isolation level transaction.

Seems 1 and 2 are conflicting? Any comments?

thanks in advance, George

like image 810
George2 Avatar asked Dec 10 '25 15:12

George2


2 Answers

Number 2 means "I can see my own changes; I can't see other changes"

So if I start a transaction and I make changes, I can see them. Other transactions for other sessions/connections started after my TXN can not see my changes

like image 162
gbn Avatar answered Dec 12 '25 04:12

gbn


You also need to know the difference between SNAPSHOT and READ COMMITTED SNAPSHOT - for the latter, you need to modify your quote from BOL as follows:

"Data modifications made by other transactions after the start of the current STATEMENT (not transaction!) are not visible to statements executing in the current transaction."

An example of a case when it makes a big difference: When Snapshot Isolation Helps and When It Hurts

like image 31
A-K Avatar answered Dec 12 '25 06:12

A-K