SQL Server:我可以使用EXEC运行外部应用程序吗? [英] SQL Server: Can I use EXEC to run an external Application?

查看:87
本文介绍了SQL Server:我可以使用EXEC运行外部应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,谢谢您的时间,

我一直在网上到处搜索一个示例,其中SQL触发器将运行外部应用程序,但是我已经没运气。我所看到的是EXEC将执行SQL过程。

I have been searching everywhere online for an example, where a SQL trigger will run an external application, but I have had no luck. All I am seeing is that the EXEC will execute a SQL procedure.

我需要这样做的原因是,我有一个包含许多表的SQL Server 2010,并且当某些表发生更新或插入时,我需要我的Talend作业来运行和更新Salesforce表。

The reason I need this is, I have a SQL Server 2010 with many tables and when an update or insert occurs on certain tables I need my Talend job to run and update the Salesforce tables.

当前Talend作业正在通过任务计划程序运行,但是公司希望信息立即移动。

Currently the Talend jobs are running through A task scheduler but the company wants the information to move right away.

当前这是我的代码

CREATE TRIGGER UP_ACCOUNT ON ARCUS
AFTER INSERT, UPDATE
AS 

IF(exists(SELECT IDCUST FROM inserted WHERE IDCUST IS NOT NULL))
    BEGIN 
        EXEC [name_of_application]
    END

我仍然需要进行所有检查以确保不会崩溃,但是EXEC语句似乎不想执行外部命令。任何建议将不胜感激。

I still need to do all the checks to make sure this will not crash anything, but the EXEC statement does not seem to want to execute external commands. Any suggestions would be greatly appreciated.

谢谢

推荐答案

补充了该帖子的答案。我永远不会从sql调用另一个应用程序。这样做的几个原因是,从安全起见,直到有人可以移动应用程序并且您需要更新触发器为止,这意味着您应对触发器和应用程序之间的直接通信负责。

Complementing the answer on that post. I would never call another app from sql. Several reasons for that, since security until the fact that someone may move the app and you would need to update your trigger, which means you are responsible for the direct communication between trigger and app.

我要做的是使触发器将数据写入表,然后有一个进程监视该表(读取和删除行),然后调用该应用程序。我知道您还有其他球员,但是更安全,更容易维护。

What I would do is make your trigger write to a table and then have a process that monitors that table (reads and delete rows) and than calls the application. I know you have another player but is safer and easier to maintain.

这篇关于SQL Server:我可以使用EXEC运行外部应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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