I tried replicating the scenario given here: https://www.sqlskills.com/blogs/paul/the-curious-case-of-the-bulk_operation-lock-during-a-heap-nolock-scan/
Created 2 tables - table1 with clustered index, table2 without any index.
When I write a select query with (lock)
on table1, there is Sch-S lock applied. Similarly, when I write the same query on table2, there also it is a Sch-S lock.
Neither case applied the S lock like shown in the above link.
To check locks I use the following query:
SELECT * FROM sys.dm_tran_locks
WHERE resource_database_id = DB_ID()
AND resource_associated_entity_id = OBJECT_ID(N'dbo.table1');
Does selecting data from heap (table without clustered index) with nolock block writers?