I want to reduce polling in my application solution (many apps, 1 database, some 3rd party), customer wants an up-to-the-second GUI status of whats going on. Is it possible to add an event handler through .NET code to a table or database using SQL Server technologies?
Here are some solutions I’ve come across:
- SQL Server Service Broker with external activation – only launches new applications, not really an “event handler” kind of scenario
- CLR stored procedures – limited in functionality, obviously will have same issue getting event to the GUI status screen
- Go custom – I could do something crazy like having the SQL Server create a file (using XP command shell) in a folder with a trigger when a qualified event occurs, then have a
FileSystemWatcherobject pick up the file change event and trigger it that way, but that smells bad somehow.
You may want to look at SqlDependency. The only caveat is that, as the docs state,
In general though I find the above statement to be true for most SQL Server client applications, so hopefully this shouldn’t be a problem.