I wrote an AFTER INSERT
Trigger in my Azure SQL DB, which works just fine from within SSMS.
我在Azure SQL DB中写了一个AFTER INSERT Trigger,它在SSMS中运行得很好。
However, I am working with a JavaScript developer creating an application which writes to the Parent Table. The calling application needs to capture what was actually inserted. So, the Javascript statement is: Insert Into {my Table]... OUTPUT INSERTED.* Values (....
. The T-SQL OUTPUT
clause description specifically states "Triggers cannot be defined on the target."
但是,我正在与JavaScript开发人员一起创建一个写入父表的应用程序。调用应用程序需要捕获实际插入的内容。因此,Javascript语句是:Insert Into {my Table] ... OUTPUT INSERTED。* Values(..... T-SQL OUTPUT子句描述明确指出“无法在目标上定义触发器”。
Does anyone have suggestions for another way around this limitation? Do we have write a Procedure to query the Parent and Insert Into the Child?
有没有人有关于此限制的另一种方法的建议?我们是否编写过程来查询父级并插入子级?
1 个解决方案
#1
1
DML statements cannot have any enabled triggers if the statement contains an OUTPUT
clause without any INTO
clause.
如果语句包含没有任何INTO子句的OUTPUT子句,则DML语句不能具有任何已启用的触发器。
There's an article about this on the Microsoft SQL Programmability & API Development Team Blog.
在Microsoft SQL可编程性和API开发团队博客上有一篇关于此的文章。
#1
1
DML statements cannot have any enabled triggers if the statement contains an OUTPUT
clause without any INTO
clause.
如果语句包含没有任何INTO子句的OUTPUT子句,则DML语句不能具有任何已启用的触发器。
There's an article about this on the Microsoft SQL Programmability & API Development Team Blog.
在Microsoft SQL可编程性和API开发团队博客上有一篇关于此的文章。