从SQL Server触发器生成进程的最佳方法
时间:2020-03-06 14:40:46 来源:igfitidea点击:
如何使用SQL Server 05/08触发器生成单独的进程?理想情况下,我希望生成该进程,并让SQL Server不要等待该进程完成执行。我需要从触发过程的插入中传递几个参数,但是可执行文件将负责其余的工作。
解决方案
我们要使用系统存储过程xp_cmdshell
此处的信息:http://msdn.microsoft.com/zh-cn/library/ms175046.aspx
我看到了该特定文章,但没有看到"产生并忘记"的选项。似乎它在等待输出返回。
xp_cmdshell operates synchronously. Control is not returned to the caller until the command-shell command is completed.
一点点CLR集成,结合SQL Service Broker可以在这里为我们提供帮助。
http://microsoft.apress.com/feature/70/asynchronous-stored-procedures-in-sql-server-2005