I wrote this script without COMMIT
in a new Query window (Query1):
BEGIN TRAN
SELECT [RegionID], [RegionDescription]
FROM [Northwind].[dbo].[Region] WITH(XLOCK,ROWLOCK)
WHERE RegionID = 3
and in another query window I write this script without COMMIT (Query2):
BEGIN TRAN
SELECT [RegionID], [RegionDescription]
FROM [Northwind].[dbo].[Region] WITH(XLOCK,ROWLOCK)
WHERE RegionID = 1
Everything is OK, when I run Query1 and then Query2 I can select row with RegioID=1
. But if I write the first query this way (Query3):
BEGIN TRAN
SELECT [RegionID], [RegionDescription]
FROM [Northwind].[dbo].[Region] WITH(XLOCK,ROWLOCK)
WHERE RegionID = 3 OR RegionID = 4
...and add RegionID = 4
in result, I can't run Query2. Why wheras Query2 result does not has intersect with Query3 I can't run it?