Studying isolation levels and blocking, more specific READ COMMITTED vs. READ COMMITTED SNAPSHOT.
In SQL Server 2014, the default isolation level is READ COMMITTED, and if I run
BEGIN TRANSACTION
SELECT top 1 * FROM Person.Person WITH (TABLOCKX, HOLDLOCK);
WAITFOR DELAY '03:00:00'
ROLLBACK TRANSACTION
and then in a new connection
SELECT * FROM Person.Person
the second query will block and hang.
In Azure SQL however, the isolation level is READ COMMITTED SNAPSHOT which seems to allow reads from Person.Person with a TABLOCKX + HOLDLOCK'ed tx in wait.
Question: How do I reproduce the blocking scenario, possibly with hints, forcing the first SELECT to block the table completely, while having READ COMMITTED SNAPSHOT on ? - as it is in Azure SQL and cannot be altered.
I have tried:
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
SELECT top 1 * FROM Person.Person WITH (TABLOCKX, HOLDLOCK);
BEGIN TRANSACTION
...
and
BEGIN TRANSACTION
SELECT top 1 * FROM Person.Person WITH (READCOMMITTED);
...
Thank you.