What is the best way to push inserted data out of SQL Server to an application?

梦想与她 提交于 2020-01-01 09:43:25

问题


I would like to use some mechanism within SQL Server (or one of its services) to push change messages out (via UDP, for example, but TCP is OK, too) when rows get inserted into a table. I would like for these messages to be more than notifications of change, but to actually contained the changed data. Is there a mechanism that comes with SQL Server 2008 R2 to do this? I've heard of Service Broker and Extended Events, but am not sure that these are the right tools for the job when it comes to getting near real time data pushed out of SQL Server to another app that needs to update its internal state when data in SQL Server changes, without having to query SQL Server (i.e., I want the data to be strictly pushed out of SQL Server).

I the worst case, I can write SQLCLR code that unicasts UDP messages containing changes, but I would like to reuse an existing service, if available.


回答1:


Since you are using SQL 2008, Change Tracking is built right in.

MSDN provides extensive information on enabling and implementing the feature. This overview article provides a high level view and this article is a great place to start on the implementation.




回答2:


Unfortunately, because SQL Server Notification Services was removed from 2008 and later, there really isn't a good built-in way to do this. Microsoft's official party line is that Reporting Services can fill the gap, but practical experience proves otherwise.

You're stuck with either a 3rd party solution or rolling your own. Good luck!



来源:https://stackoverflow.com/questions/6297392/what-is-the-best-way-to-push-inserted-data-out-of-sql-server-to-an-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!