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***********@s qlserver.com'
Is this solution a good method?
Thanks,
Guju 4 1747
"Guju" <pa**********@y ahoo.com.au> wrote in message
news:42******** @news.iprimus.c om.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***********@s qlserver.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***********@s qlserver.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
**********************************
package Celcom.Client;
|
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
DISK='h:\backups\DB1\DB1_db_200411082056.BAK', RECOVERY (Message 0) Processed 3816 pages for database 'DB1', file
'DB1_Data' on file 1. (Message 4035) Processed 1
pages for database 'DB1', file 'DB1_Log' on file 1.
(Message 4035)")
Currently, the Job History box contains...
|
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
User1@here.whatever and User4@here.whatever but if "Loaded" is chosen
it needs to email User2@here.whatever and User3@here.whatever, etc,
etc...
I'm aware that the only thing that really needs to change is the
"Mail.AddAddress" line (at least...
|
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 provide me some hints.
Thanks,
|
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;
=============================================================================
Dim strRecipient As String
Dim strSubject As String
Dim strMessageBody As String
| |
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 while (This
information is just for general knowledge as I don't want anyone
thinking I am trying to be dishonest with my intentions. Also, I do not
portray myself as something I am not. I am a beginner.)
Anyway, what the script needs to do is...
|
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 inserting, I want to send the data via email, the problem is how
do I do that?
|
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 our website and enter data (insert record), on our end, we have an Access application where we can play with the data that was entered via the website. Currently, we do not have either server set up as a Mail server.
What we need to be able to do:...
|
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 except that
I can't get the value of holiday_ID included as a querystring. As a
test I can insert a value after the ?id= and this is passed as a
querystring.
I am sure it's just the syntax that I am having problem with
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |