?
Solved

Email alert when data is written to a table

Posted on 2013-10-25
4
Medium Priority
?
256 Views
Last Modified: 2013-10-25
Trying to reduce expensive developer time on our DotNetNuke website. I don't think I need to go in to the backstory so I will simply ask - is there a way I can set up an alert (email, preferably) so that I am notified whenever anything is written to a specific SQL Server database table?
0
Comment
Question by:K_Deutsch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
strivoli earned 2000 total points
ID: 39600714
Yes. Use a trigger on INSERT or UPDATE that sends a mail to an operator using SQL's built in mail system.
0
 

Author Comment

by:K_Deutsch
ID: 39600881
I set up an email account in SQL Server Database Mail and sent a successful test email, but I need a little more direction on building the alert, as this is new to me.

Database: ABC
Table: sp_ABC_DB_OnlineFormsConfirm
0
 

Author Comment

by:K_Deutsch
ID: 39601016
Actually I am almost there. The below was successfully tested, but is there a way that in the email generated I can insert the unique ConfirmationCode that is captured so the alerted person knows what exactly to follow up on?

CREATE TRIGGER SendEmail
ON [ABC].[dbo].[ABC_DB_OnlineFormsConfirm]
AFTER INSERT
AS
exec msdb.dbo.sp_send_dbmail @profile_name = 'Gmail',
            @recipients = 'ABC@ABC-inc.com',
            @subject='An ABC Online App Has Been Completed',
            @body=''
0
 
LVL 20

Expert Comment

by:strivoli
ID: 39601353
You should be able to add any data to the mail. Even the single field values.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question