Search code examples
sql-serverazuretransactionsazure-sql-database

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?


Solution

  • You need

    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;  
    

    before your Select statement.