【发布时间】:2012-08-14 09:41:05
【问题描述】:
我已成功配置并能够通过调用 msdb.dbo.sp_send_dbmail 存储过程在 SQL Server 2008 R2 上使用“数据库邮件”发送电子邮件。 我可以通过将它放在 try-catch 块中来捕获触发器中的查询失败。
但我需要做的是,当触发器无法执行查询时发送电子邮件。但是我不能在 catch 块中执行上面的存储过程。它给了我以下错误。
Msg 3930, Level 16, State 1, Procedure sp_send_dbmail, Line 64
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.
The statement has been terminated.
还有其他方法可以在触发失败时发送电子邮件吗? 或者如何解决这个问题?
【问题讨论】:
标签: sql sql-server email triggers django-mssql