Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

SELECT hangs despite Snapshot Isolation

$
0
0
- 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?   
    
   

Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>