Create Insert Trigger for SQLAgentMail

87 Views Asked by At

Is it possible to create a trigger the will use SQLAgentMail and email an operator?

1

There are 1 best solutions below

0
On BEST ANSWER

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.