When we issue a select statement , it puts a shared lock and during shared lock other transactions can not do an update. So i am trying to do the following as shown in the below code.
I have started a transaction and then put a delay for 50 seconds. I open other query window and try to do a update to the same record. I was expecting the update should be get blocked for 50 seconds , but it just executes. Is that after select shared lock is released , any way i put in wait shared mode.
begin tran
select * from tblCustomer where CustomerId=1
WAITFOR DELAY '00:00:50'
commit tran
When i do this for update it works. I mean when i put update inside begin tran and committ tran and execute select in committed mode , select blocks.