Hello
I have created a update grigger. I want to send a mail whenever is trigger
is fired. I tried using xp_sendmail, but it required mapi account to be
configured in server. I want to avoid this situation. Can I use cdo code in
trigger?
regards
Ashish"Ashish kanoongo" <ashishkanoongo@.hotmail.com> wrote in message
news:uuyGHXVoHHA.4032@.TK2MSFTNGP02.phx.gbl...
> Hello
> I have created a update grigger. I want to send a mail whenever is trigger
> is fired. I tried using xp_sendmail, but it required mapi account to be
> configured in server. I want to avoid this situation. Can I use cdo code
> in trigger?
I believe so. But I wouldn't recommend it.
It'll really mess up performance.
You're better off having the trigger enter a row into a table and then
having a scheduled task go through once every X minutes sending emails.
> regards
> Ashish
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||Well for SQL Server 2000 I agree, but as the Mail Service is now
enabled with SQL Server Service Broker in SQL Server 2005 you *could*
consider doing this within a trigger.
Jens K. Suessmeyer.
--
http://www.sqlserver2005.de
--|||Try xp_smtp_sendmail.
--
TheSQLGuru
President
Indicium Resources, Inc.
"Ashish kanoongo" <ashishkanoongo@.hotmail.com> wrote in message
news:uuyGHXVoHHA.4032@.TK2MSFTNGP02.phx.gbl...
> Hello
> I have created a update grigger. I want to send a mail whenever is trigger
> is fired. I tried using xp_sendmail, but it required mapi account to be
> configured in server. I want to avoid this situation. Can I use cdo code
> in trigger?
> regards
> Ashish
>|||DOn=B4t use xp_smtp_sendmail in a trigger, this will start a mail
session within the current transaction, leading to the problem that
the transaction will be staled during the mail sending process as it
does not behave asynchronously in comparison to Service Broker enabled
DBMail.
Jens K. Suessmeyer.
--
http://www.sqlserver2005.de
--|||Hello All
I tried following solution, it is working for me. I like to know pros/cons
on this if any.
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=20649
Ashish
"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1180409187.775983.273450@.u30g2000hsc.googlegroups.com...
DOn´t use xp_smtp_sendmail in a trigger, this will start a mail
session within the current transaction, leading to the problem that
the transaction will be staled during the mail sending process as it
does not behave asynchronously in comparison to Service Broker enabled
DBMail.
Jens K. Suessmeyer.
--
http://www.sqlserver2005.de
--|||I already pointed out the cons, the same applies for this solution as
it might stale your application and the transaction with it. I
addition, the process might cancel the transaction if you execute it
within a trigger, depending on the error level coming back, The con
against a solution with a mail table and a scheduled delivery is that
it would not be send immediately, but you could implement something
like a retry whereas you cannot do this in the above procedure used
within a trigger. The best thing is to use the Service broker enabled
mail service if you are using SQL Server 2005. If you are using SQL
Server 2000 you should use a mail table which queues up mails and
sends them periodically.
Jens K. Suessmeyer.
--
http://www.sqlserver2005.de
--|||Sorry, I didn't see the user state he was using SQL Server 2005. Oh, wait.
. . he didn't! :-)
--
TheSQLGuru
President
Indicium Resources, Inc.
"Jens" <Jens@.sqlserver2005.de> wrote in message
news:1180409187.775983.273450@.u30g2000hsc.googlegroups.com...
DOn´t use xp_smtp_sendmail in a trigger, this will start a mail
session within the current transaction, leading to the problem that
the transaction will be staled during the mail sending process as it
does not behave asynchronously in comparison to Service Broker enabled
DBMail.
Jens K. Suessmeyer.
--
http://www.sqlserver2005.de
--
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment