Solved

Send email when a SQL column is changed

Posted on 2011-03-01
2
271 Views
Last Modified: 2012-06-21
Hi
I have a sql 2005 table with a column names pin_number how do I generate an email or alert whenever this field is deleted or updated?
0
Comment
Question by:sykotex
2 Comments
 
LVL 8

Accepted Solution

by:
Som Tripathi earned 250 total points
ID: 35010403
Create a trigger and on update and delete. If you find the column is changed - send a mail.
0
 
LVL 4

Assisted Solution

by:rocky_lotus_newbie
rocky_lotus_newbie earned 250 total points
ID: 35011792
The Below Artticle has the details of how to configure the Database Mail in SQL 2008.

http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/


Once you set it up:

Include the Below command in the DELETE/UPDATE Trigger to send an email to the desired email id.


USE msdb
GO
EXEC sp_send_dbmail @profile_name='PinalProfile',
@recipients='test@Example.com',
@subject='Test message',
@query = 'select * from table where condition=''YES'''
@body='This is the body of the test message.
Congrates Database Mail Received By you Successfully.',
@attach_query_result_as_file = 0,
@query_result_width=5000


This link has the syntax for sample Delete/Update trigger:

http://www.kodyaz.com/articles/sql-trigger-example-in-sql-server-2008.aspx


Thanks,
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now