问题
Using .Net 4.0 and SQL Server 2008 R2
I have been looking into utilizing SqlDependency / SqlNotifications for monitoring some database structures. Is the best process / practice for this to utilize the SqlDependency / SqlNotifications with SQL Server Service broker?
Are folks using other methods to accomplish a similar task? I could always poll for changes, but I would rather not have to do that. On the other hand I don't want to introduce a complex scenario into our existing environment either.
EDIT (Potential Options):
- SqlDependency
- Service Broker External Activation
回答1:
Check out event notifications:
http://msdn.microsoft.com/en-us/library/ms175854.aspx
来源:https://stackoverflow.com/questions/9299620/how-do-i-listen-for-sql-server-database-changes