Create Insert Trigger for SQLAgentMail
Is it possible to create a tri开发者_StackOverflowgger the will use SQLAgentMail and email an operator?
It is generally not a good idea to write a trigger to send anemail, do you really want users to be locked out of changing the table is the email server is down?
Usually the process is that you send the info you want in the email to a table in the trigger and then write a job that looks in the emails to send table, sends the emails and updates that they were sent. This job runs every five minutes or so. This is close to real time without the problem of breaking the table if the email is down. It also gives a nice record of what emails were sent which can be handy at times.
精彩评论