Database trigger that communicates with an external program

天大地大妈咪最大 提交于 2019-12-22 12:02:14

问题


I've got a SQLServer Database and an application (.NET) that configures data on that database. On the other hand, I've got an application (VC++) that reads that data from the database and must be 'informed' a soon as possible of any change in the data saved on the database.

I would like to receive a signal from the database engine when some data had been changed by the first app. Of course, I can code some kind of message that comunicates both apps but my question is if exists that mechanism (some kind of ultra-trigger that warns the other app) in SQLServer or in any API for accessing SQLServer (Native, OLE DB, or even ODBC)

PS: Apologize for my english


回答1:


You can use a SQL Agent Job that will notify the other app starting it with sp_start_job. Check this out.




回答2:


If your requirements include guaranteed delivery (e.g. no lost events) - you might want to consider an MSMQ based strategy.

Accessing MSMQ from Microsoft SQL Server

http://www.codeproject.com/KB/database/SqlMSMQ.aspx

Microsoft Support Knowledge Base Article: 555070 Posting Message to MSMQ from SQL Server

http://support.microsoft.com/kb/555070



来源:https://stackoverflow.com/questions/319987/database-trigger-that-communicates-with-an-external-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!