从 SQL Server 触发器发送消息 [英] Send message from SQL Server trigger
问题描述
当 SQL Server (2005) 中发生某些事情时,我需要向正在运行的应用程序(Windows 服务)发出信号.是否可以将消息从触发器发送到同一系统上的外部应用程序?
I need to signal a running application (Windows service) when certain things happen in SQL Server (2005). Is there a possibility to send a message from a trigger to an external application on the same system?
推荐答案
要么:
使用 RAISERROR(严重性 10)触发 SQL 代理警报和作业.
Use RAISERROR (severity 10) to fire a SQL agent alert and job.
加载一个单独的表,该表由单独的邮件处理进程定期轮询.(按照 HLGEM 的建议)
Load a separate table that is polled periodically by a separate mail handling process. (as HLGEM suggested)
使用存储过程发送消息并写入表.
Use a stored procedure to send the message and write to the table.
每个解决方案都将事务触发器与可能很长的消息传递调用分离.
Each solution decouples the transactional trigger from a potentially long messaging call.
这篇关于从 SQL Server 触发器发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!