Environment: SQL SERVER 2008 R2, Windows.
CONNECTION-1: executing following
BEGIN TRANSACTION
UPDATE Check_lock with (rowlock)
set LayoutType = 98
where USERID between 1 and 7;
WAITFOR DELAY '000:10:00';
COMMIT TRANSACTION;
CONNECTION-2: executing following
BEGIN TRANSACTION
UPDATE Check_lock with (rowlock)
set LayoutType = 98
where USERID between 15 and 20;
COMMIT TRANSACTION;
Problem Statement: I am executing above transactions through SQL Server Management Studio by making two connections with the same server/database on same machine at same time. Though the table is same & transactions are executing at same time (not 100% same time, because executing manually) but updating different rows (row-level locking) then why the "Conneciton-2" transaction did not get committed immediately and goes in wait until the first transaction is not committed/completed. ??
Please let me know if I didn't describe my scenario clearly.