Can I call a C# function by a SQL Server trigger?

后端 未结 2 1628
后悔当初
后悔当初 2021-01-13 18:07

An external application come to my database for inserting row in a Sql server table.

I have a web application on my own, and I want on each insert in this table, do

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-13 18:36

    If your function is going to take a long time to run, or going to access resources which aren't part of the same database, you might want to consider decoupling the function call from the trigger (so that the original statement that caused the trigger to fire can complete).

    In that case, you might want to look at Service Broker, or just use a separate table to queue the requests to call the function (and use a SQL Agent job to dequeue these requests and call the function).

提交回复
热议问题