开发者

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

开发者 https://www.devze.com 2023-03-11 23:55 出处:网络
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 f

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.


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.


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消