SQl Server: serializable level not working

Posted by Zé Carlos on Stack Overflow See other posts from Stack Overflow or by Zé Carlos
Published on 2010-12-29T12:43:08Z Indexed on 2010/12/29 12:54 UTC
Read the original article Hit count: 251

Filed under:
|
|

I have the following SP:

CREATE PROCEDURE [dbo].[sp_LockReader]  
AS  
BEGIN  
SET NOCOUNT ON;  
begin try   
set transaction isolation level serializable  
begin tran  
select * from teste  
commit tran  
end try  
begin catch  
rollback tran  
set transaction isolation level READ COMMITTED  
end catch  
set transaction isolation level READ COMMITTED  
END  

The table "test" has many values, so "select * from teste" takes several seconds. I run the sp_LockReader at same time in two diferent query windows and the second one starts showing test table contents without the first one terminates.

Shouldn't serializeble level forces the second query to wait? How do i get the described behaviour? Thanks

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server