StuffHappens
StuffHappens

Reputation: 6557

Read uncommitted isolation level doesn't allow to read entries

I need to read dirty entries in Sql server but I don't understand why I can't. Hope you will help. I have two tabs in management studio with following code
Tab 1:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
GO
BEGIN TRAN
    UPDATE decision.tRequests
    SET IsComplete = 0

    WAITFOR DELAY '00:00:25.000'        
COMMIT TRAN  

Tab 2:

SELECT * FROM decision.tRequests

When I run tab1 and then tab2 I can see that the query from tab2 takes more than 25 seconds to complete. When run script form tab2 without tab1 it take 0 seconds to complete.
Why even if I have SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED are the entries locked?

Upvotes: 0

Views: 1121

Answers (2)

SQLMenace
SQLMenace

Reputation: 135011

in Tab 2

SELECT * FROM decision.tRequests with (nolock)

Upvotes: 1

Martin Smith
Martin Smith

Reputation: 453278

You need to set SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED in Tab2 not Tab1.

Tab2 will still be running under the default READ COMMITTED level.

Upvotes: 2

Related Questions