One connection starts a transaction and selects with xlock:
select * from mytable with (xlock);
Another connection tries to read and succeeds:
select id from mytable;
Another connection tries to read and blocks:
select * from mytable;
I thought the xlock would block all reads, but it is not blocking these on an indexed field.
Is that right?
If I use (tablockx) it does block the ID.
This is all on SQL 2016.
Thanks,
Josh