michal.jakubeczy
michal.jakubeczy

Reputation: 9489

Read Uncommited SQL Azure

I am running following SQL statement on SQL Azure database:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;  
BEGIN TRANSACTION;  

UPDATE Project SET Name = 'NewLim2' WHERE Projectid = 403179
WAITFOR DELAY '00:00:10'

COMMIT TRANSACTION

Then during the 10 seconds delay I use another connection which performs following select:

SELECT * FROM Project WHERE Projectid = 403179

But its result is 'NewLim' as Name (original value) and 'NewLim2' is after the committing. When I run transaction with Read uncommitted I suppose that it will read updated value even before commit. Or am I missing something?

Upvotes: 1

Views: 678

Answers (3)

Patrick Verboom
Patrick Verboom

Reputation: 1

Can't you just make your query, ending by "WITH UR" like we can do in e.g. DB2?

So:

SELECT * FROM Project WHERE Projectid = 403179 WITH UR

Upvotes: -1

TheGameiswar
TheGameiswar

Reputation: 28930

Just wanted to point out,Isolation levels are only for select Statements,below statement you have in your update doesn't make any sense

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;

Reason why you didn't got uncommitted data was due not having required Isolation level in your select as mentioned in answer

Upvotes: 1

spodger
spodger

Reputation: 1679

You need

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;  

before your Select statement.

Upvotes: 2

Related Questions