SQL Server: wait for new row
.net, database, locking, service-broker, sql-server
Solution
The normal way is to use polling, but if you really need immediate events you can use the `SqlDependency` class to get an event when the result of a query changes.
Problem
How can I wait for a new row appearing in a SQL Server table from a .NET client application? Background: I'd like to build a message queue based on a table. I don't want to use Service Broker because I want messages to be structured and strongly typed. Using a normal table I can have relations with other tables, too.