将插入的数据从 SQL Server 推送到应用程序的最佳方法是什么? [英] What is the best way to push inserted data out of SQL Server to an application?

查看:28
本文介绍了将插入的数据从 SQL Server 推送到应用程序的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当行插入到表中时,我想使用 SQL Server(或其服务之一)中的某种机制来推送更改消息(例如,通过 UDP,但 TCP 也可以).我希望这些消息不仅仅是更改通知,而是实际包含更改的数据.是否有 SQL Server 2008 R2 附带的机制来执行此操作?我听说过 Service Broker 和 Extended Events,但在将接近实时的数据从 SQL Server 推送到另一个需要更新其内部状态的应用程序时,我不确定这些是适合这项工作的工具在 SQL Server 中更改,无需查询 SQL Server(即,我希望将数据严格推出 SQL Server).

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).

最坏的情况是,我可以编写单播包含更改的 UDP 消息的 SQLCLR 代码,但我想重用现有服务(如果可用).

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.

推荐答案

由于您使用的是 SQL 2008,更改跟踪是内置的.

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

MSDN 提供了有关启用和实施该功能的大量信息.这篇概述文章提供了一个高级视图和这篇文章是开始实施的好地方.

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.

这篇关于将插入的数据从 SQL Server 推送到应用程序的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆