Avoid External Dependencies in SQL Server Triggers

Posted on SQL Server Central See other posts from SQL Server Central
Published on Mon, 14 Feb 2011 07:00:00 UT Indexed on 2011/02/14 7:31 UTC
Read the original article Hit count: 168

Filed under:
I sometimes want to perform auditing or other actions in a trigger based on some criteria. More specifically, there are a few cases that may warrant an e-mail; for example, if a web sale takes place that requires custom or overnight shipping and handling. It is tempting to just add code to the trigger that sends an e-mail when these criteria are met. But this can be problematic for two reasons: (1) your users are waiting for that processing to occur, and (2) if you can't send the e-mail, how do you decide whether or not to roll back the transaction, and how do you bring the problem to the attention of the administrator?

© SQL Server Central or respective owner