Tuesday, March 20, 2012

Alert a user from SQL Sever Trigger

Hi
We are trying to alert a user from a trigger in SQL Server.
We are currently using a Trigger to produce an email to the user, which is
not ideal due to the quantity of times the alert will be raised during the
day.
Any suggestions would be ideal.
Thanks
BDon't send email from a trigger (see
http://www.google.co.uk/groups?&sel... />
groups.com)
Instead, schedule the notification process at regular intervals to poll
the required table (based on an updated datetime column for example)
and send notifications as required.
Consider using Notification Services:
http://www.microsoft.com/sql/ns/default.asp
David Portas
SQL Server MVP
--|||Ben
Yes , it is not ideal.
It hurts performance ,so you are going to change the logic to alter your
users.
Have you looked at Alerts under Management folder in EM?
"Ben" <Ben@.NoSpam.com> wrote in message
news:uKzBiUPOFHA.3076@.TK2MSFTNGP14.phx.gbl...
> Hi
> We are trying to alert a user from a trigger in SQL Server.
> We are currently using a Trigger to produce an email to the user, which is
> not ideal due to the quantity of times the alert will be raised during the
> day.
> Any suggestions would be ideal.
> Thanks
> B
>|||This kind of thing is exactly what notification services is for... It is
designed to scale huge, and it comes with SQL Server... Joe Webb has written
a nice coverage of notification services in a book published by Mann
Publishing.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Ben" <Ben@.NoSpam.com> wrote in message
news:uKzBiUPOFHA.3076@.TK2MSFTNGP14.phx.gbl...
> Hi
> We are trying to alert a user from a trigger in SQL Server.
> We are currently using a Trigger to produce an email to the user, which is
> not ideal due to the quantity of times the alert will be raised during the
> day.
> Any suggestions would be ideal.
> Thanks
> B
>|||Hi David & Uri
I agree that we should not send emails in Triggers.
As this is for a single user I believe that the Notification Services may
cost too much.
Is it possible to use windows messaging?
Thanks
B
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:efxBacPOFHA.2748@.TK2MSFTNGP09.phx.gbl...
> Ben
> Yes , it is not ideal.
> It hurts performance ,so you are going to change the logic to alter your
> users.
> Have you looked at Alerts under Management folder in EM?
>
> "Ben" <Ben@.NoSpam.com> wrote in message
> news:uKzBiUPOFHA.3076@.TK2MSFTNGP14.phx.gbl...
>|||Apologies everyone I did not realise Notification Services was part of SQL
Server.
I will look into it, it seems that it could solve three other problems that
I have too!
Many thanks for your posts
B
"Wayne Snyder" <wayne.nospam.snyder@.mariner-usa.com> wrote in message
news:O2TKQMROFHA.2728@.TK2MSFTNGP15.phx.gbl...
> This kind of thing is exactly what notification services is for... It is
> designed to scale huge, and it comes with SQL Server... Joe Webb has
> written a nice coverage of notification services in a book published by
> Mann Publishing.
>
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Ben" <Ben@.NoSpam.com> wrote in message
> news:uKzBiUPOFHA.3076@.TK2MSFTNGP14.phx.gbl...
>|||There is no purchase cost for Notification Services itself but you do
need to be able to comply with the licensing requirements. (see "How to
Obtain" under the link posted previously)
If NS doesn't suit you then I recommend xp_smtp_sendmail. Very easy to
setup and configure. See the following for more info:
http://www.aspfaq.com/show.asp?id=2403
David Portas
SQL Server MVP
--

No comments:

Post a Comment