Hi all,
I wanted sql server to shoot an email upon insert into a table. I treated a
trigger on that table as below.
CREATE TRIGGER [emailoninsert] ON [dbo].[table_name]
FOR INSERT
AS
exec sp_sendSMTPmail 'u***@user.com', 'New records are inserted in
table_name table', 'Please investigate and take necessary actions.',
@cc='', @BCC = '',
@Importance=1,
@Attachments='', @HTMLFormat = 0,@From =
'n***********@sqlserver.com'
Is this solution a good method?
Thanks,
Guju 4 1730
"Guju" <pa**********@yahoo.com.au> wrote in message
news:42********@news.iprimus.com.au... Hi all,
I wanted sql server to shoot an email upon insert into a table. I treated
a trigger on that table as below.
CREATE TRIGGER [emailoninsert] ON [dbo].[table_name] FOR INSERT AS exec sp_sendSMTPmail 'u***@user.com', 'New records are inserted in table_name table', 'Please investigate and take necessary actions.', @cc='', @BCC = '', @Importance=1, @Attachments='', @HTMLFormat = 0,@From = 'n***********@sqlserver.com' Is this solution a good method?
No.
It will greatly slow down insert speeds. Thanks,
Guju
Guju wrote: Hi all,
I wanted sql server to shoot an email upon insert into a table. I
treated a trigger on that table as below.
CREATE TRIGGER [emailoninsert] ON [dbo].[table_name] FOR INSERT AS exec sp_sendSMTPmail 'u***@user.com', 'New records are inserted in table_name table', 'Please investigate and take necessary actions.', @cc='', @BCC = '', @Importance=1, @Attachments='', @HTMLFormat = 0,@From = 'n***********@sqlserver.com' Is this solution a good method?
Thanks,
Guju
It may be a better idea to create a script that checks for new records
in the table every x number of hours (run it as an sql agent job).
the script may save the last record id that it already saw in a table
for this purpose.
As mentioned above, the solution you implemented means the email is
sent at the expense of the insert statement , making it horribly slow.
My way you can also send one mail if 10 records were inserted in stead
of 10, with the data of all 10, which you may trust me is more useful
to the sorry person actually receiving these mails.
hope this helps.
Tzvika
Is it possible for you to post a sample script..I am attempting to get
the same result as the author.
Is it possible for you to post a sample script..I am attempting to get
the same result as the author. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: James Hong |
last post by:
Help please, I try to sending an email from my html page using the java
applet.
but it give error on most of the PC only very few work, what is the error i
make
the java applet show as below
...
|
by: Michael Bourgon |
last post by:
I need to build an automated email that gives the completion messages
when a database is restored (i.e. "Executed as user: sa. Executing
RESTORE DATABASE DB1 FROM...
|
by: dmiller23462 |
last post by:
So here's my problem.....I need to set up different email
distributions based on which option in the following Select form has
been chosen....For instance if "Putaway" is chosen it needs to email...
|
by: Guju |
last post by:
Hi,
I wish to use email functionality of sql to send me an email when an insert
is performed on a particular table. I know that a proc and may be a trigger
is required.
Can someone please...
|
by: Del |
last post by:
I have two question on sending email messages from MS Access (Versio
2000, 2002, and 2003). I have a form with a command button to send an
email message, the code behide the button is as follows;...
|
by: Jerim79 |
last post by:
I am no PHP programmer. At my current job I made it known that I was no
PHP programmer during the interview. Still they have given me a script
to write with the understanding that it will take me a...
|
by: YMPN |
last post by:
Hi Everyone,
I'm deen from Riyadh.
Please do help me with some problem i have. I have this formview
control setup to recieved inputs from user (textbox, dropdownlist,
others).
After...
|
by: vmethod |
last post by:
The low down:
Local Web Server on Windows 2003
Local SQL Server on Windows 2003
Hosting dynamic website tied to inhouse Access Application
Ok, basically, how it is set up, people can login to...
|
by: paulmitchell507 |
last post by:
I have a file called email2.asp which I am using to mail data obtained
from a SQL query. I would like to pass the holiday_ID value in the
querystring attached to the end of the URL. It all works...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |