SQL SERVER触发净通话 [英] Sql server trigger to .Net call

查看:137
本文介绍了SQL SERVER触发净通话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当记录插入或SQL Server表更新了,我必须调用第三方服务,将插入/更新他们的桌子。什么是最有效的方法来做到这一点?

  1. SQL服务器触发到.NET调用(我不知道这是可能的?是否有可能记录的ID发送到只要插入/更新出现.NET应用程序?)

  2. 连续使用SELECT语句变化表,检查应用程序,获得特定的记录 - >发送至服务

  3. 别的东西吗?

解决方案

在SQL Server 2005和以上的,你必须创建的 CLR存储过程,该存储运行标准的.NET code程序,而不是SQL相关code 。有一些限制到什么可以做,但你可以很容易地创建一个INSERT触发器传递新记录的@@ IDENTITY添加到CLR存储过程,做了净处理需要。

Whenever a record is inserted or updated in a sql server table, I have to call a third party service which will insert/update their table. What is the most efficient way to do this?

  1. SQL server trigger to .Net call (I'm not sure if this is possible... Is it possible to send the id of the record to a .Net application whenever insert/update occurs?)

  2. An application which checks continuously for changes in the table using a select statement, get the particular record -> send through service.

  3. Something else?

解决方案

In SQL Server 2005 and above, you have the ability to create CLR Stored Procedures, which are stored procedures that run standard .Net code, as opposed to SQL related code. There are some limitations to what it can do, but you could easily create an insert trigger that passes the @@IDENTITY of the new record added to a CLR stored procedure that does the .Net processing you need.

这篇关于SQL SERVER触发净通话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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