SQL SERVER触发净通话SQL、SERVER

2023-09-03 05:46:52 作者:遇晚

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

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

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

别的东西吗?

解决方案

在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?

SQL Server 2008可以安装在win7 64位的系统上吗

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

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

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.