Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
koptastic69
Starting Member
7 Posts |
Posted - 2010-06-08 : 05:10:51
|
| I have a table of orders that when a row is added, an email is sent to a static email address, advising the recipient that a new order has been placed. I want the email to include the relevant information relating to the order, and so I want to include information from a view to achieve this.How do I go about setting up the email trigger and get it to include the view of the information, rather than just the row info from the order table. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-06-08 : 05:25:03
|
Without seeing your trigger it is not easy for us.There is maybe a select inside your trigger that fills the message body. This select can be rewritten to select data from a view.But please don't give a heavy work to the trigger because of performance in storing orders by your application! No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2010-06-08 : 06:11:39
|
| It would be better to add the email call to whatever process you have when you insert.As webfred mentioned you don't want to do this with a trigger. What if you need to do a manual insert to this table? / bulk upload. You don't want a thousand emails firing off.Add this to your stored proc / whatever interface you use for inserting an order.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
|
|
|