- I'm trying to learn isolation levels.
SET TRANSACTION ISOLATION LEVEL Read Snapshot
I thought this would allow me to issue a SELECT on a dirty row (I thought it would show me the clean version of the row). But my test failed - the SELECT hangs/pends. Why?
- First I dirtied a row:
if object_id('tblTestTrans') is not null drop table tblTestTrans
create table tbltestTrans (
id int
)
insert into tbltestTrans (id) values (1)
Begin Tran
Update tbltestTrans set id = 2
Then I ran a SELECT in a new query window:
ALTER DATABASE TestDb Set Allow_SnapShot_Isolation ON
SET TRANSACTION ISOLATION LEVEL Snapshot
select * from tblTestTrans -- hangs
The select hangs. Why?
SET TRANSACTION ISOLATION LEVEL Read Snapshot
I thought this would allow me to issue a SELECT on a dirty row (I thought it would show me the clean version of the row). But my test failed - the SELECT hangs/pends. Why?
- First I dirtied a row:
if object_id('tblTestTrans') is not null drop table tblTestTrans
create table tbltestTrans (
id int
)
insert into tbltestTrans (id) values (1)
Begin Tran
Update tbltestTrans set id = 2
Then I ran a SELECT in a new query window:
ALTER DATABASE TestDb Set Allow_SnapShot_Isolation ON
SET TRANSACTION ISOLATION LEVEL Snapshot
select * from tblTestTrans -- hangs
The select hangs. Why?