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 |
|
PatDeV
Posting Yak Master
197 Posts |
Posted - 2009-01-20 : 21:35:04
|
| Hi all,how can is do this portion.I have procedure that does update and insert ( insert if data is not exist else update)now i would like to send email saying how may records inserted and updated? Please help!! |
|
|
nathans
Aged Yak Warrior
938 Posts |
Posted - 2009-01-20 : 22:37:05
|
| You can use a trigger on the table and call DB Mail procs from there to send the mail. Both of these are well documented in BOL and on the net.Nathan Skerl |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-21 : 09:19:51
|
| why should you use trigger for doing this? it will have a serious impact on performance. Isnt it better to track the insert/updates via a audit table and then use scheduled job to email the results after a predefined interval? |
 |
|
|
nathans
Aged Yak Warrior
938 Posts |
Posted - 2009-01-21 : 10:02:48
|
| sure, I was just offering a simple answer to a simple question. he could use an audit table (perhaps using a trigger to store the changes ;) ), he could use @@rowcount and output clause, or send the email directly from the proc performing the dml.Nathan Skerl |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-21 : 11:13:28
|
quote: Originally posted by nathans sure, I was just offering a simple answer to a simple question. he could use an audit table (perhaps using a trigger to store the changes ;) ), he could use @@rowcount and output clause, or send the email directly from the proc performing the dml.Nathan Skerl
yup...that sounds like what i would strongly recommend |
 |
|
|
|
|
|