SQL Server Process Queue Race Condition
Edit: I googled to check my answer: “Processing Data Queues in SQL Server with READPAST and UPDLOCK”. It’s been years since I read about and played with this solution. Original: If you use the READPAST hint, then locked rows are skipped. You’ve used ROWLOCK so you should avoid lock escalation. You also need UPDLOCK, as … Read more