I have a table that represents incoming records, which has an ISPROCESSED column. I have multiple threads that select all rows where ISPROCESSED=0 with an exclusive row lock (XLOCK,ROWLOCK) and then perform a relatively long-running transaction. At the end they update the ISPROCESSED row to 1.
If when one thread in the pool is running this transaction, other threads are blocked from processing any new records that may come into the table during the first thread's transaction, and must wait for it to complete.
Theoretically, another thread should be able to process any new unprocessed records that come in (and place its own row locks on them). Is there any way to allow the select run by the other threads to not block, and simply select the rows on which there is no current exclusive lock? In other words, to see the table as though the currently locked rows don't even exist.