When you have a hammer, everything looks like a nail. Unfortunately, a lot of people don’t even know how to use a hammer correctly.
You really shouldn’t be doing queues in the database because:
- They’re a blocking nightmare, constantly locking rows in highly concurrent tables
- They’re a logging nightmare, constantly pouring data into the transaction log
- They’re an HA/DR nightmare, constantly causing slow writes to your sync replicas
- They’re a backup nightmare, constantly changing pages that bloat your differential backups
- They’re a licensing nightmare, causing a lot of work on an expensive relational database for tables that have no relational joins to anything else whatsoever
- There are simple, cheap queueing alternatives like Amazon SQS and a few in Azure
If you really gotta do queues in SQL Server, read how to use locking hints.