插入后触发器中的错误处理 [英] Error Handling in the after insert trigger

查看:104
本文介绍了插入后触发器中的错误处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在插入触发器之后处理错误。我正在编写一些.net代码,用于在表格(email_sent)中插入数据。在触发后,我写了一些代码将数据插入到其他表(任务)中。如果在后触发器中发生任何错误整个语句被回滚并且在tableHow中都没有发生插入,而不会影响原始表(email_Sent)的插入语句以在回滚之前提交事务。

解决方案

看看这个



trigger-with-error-handling [ ^ ]



tsql-try-catch-transaction-in-trigger [ ^ ]



希望你能得到一些想法..

i want to handle the error in after insert trigger .i am writing some .net code for insert the data in table(email_sent).in after trigger ,i wrote some code to insert the data in other table(task).if any error occur in the after trigger whole statement is roll back and insertion is not happening in both table.how to over this situation without affecting insert statement of the original table(email_Sent) to commit the transaction before roll back.

解决方案

Have a look at this

trigger-with-error-handling[^]

tsql-try-catch-transaction-in-trigger[^]

Hope you will get some idea..


这篇关于插入后触发器中的错误处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆