Home Forums SQL Server 2012 SQL Server 2012 - T-SQL Challenge with trigger to send email, including attached file. @query needs variables... RE: Challenge with trigger to send email, including attached file. @query needs variables...

  • Sending mail from code in the application is, most of the time, problematic. A typical approach is to insert a message into a queue table, and have a separate job process this queue.

    As an example, this was the method of a previous client. The application took a request from a client, and notified the proper technician via email. When they moved the database servers to another location, the app appeared to hang until the mail was processed.

    Two days of blaming the database.

    Read the stairways series on this sight.

    And, seriously, how did you come up with this architecture? The original intent of triggers was to enforce referential integrity. That's it.

    EVERY app that I have encountered that rely upon triggers to enforce business logic are some of the worst performing and troublesome applications I have had to deal with. There is no exception for me. If logic is encapsulated in a trigger, there is trouble.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/