简体   繁体   中英

Send email when certain Data is being inserted or changed in MS SQL Server

I would like to know if possible and how I would achieve the following, whenever a new row is inserted into the following table (Contact) and the Confidential_flag Column has “Y” an email is sent to a user.

im unable to upload an image of the data but bellow is my select statement

SELECT NAME_DIWOR, CONFIDENTIAL_FLAG, SURNAME, COMM_NO, ADDRESS, ConTACT_TYPE, CLIENTCODE FROM CONTACT

Thank you

You can use a Triggers to fire events and perform some action when data is inserted, updated, or deleted from a table and use xp_sendmail stored procedure can be invoked to send an email. This link explain more details how get this goal.

http://www.datasprings.com/resources/articles-information/creating-email-triggers-in-sql-server-2005

Create a trigger on the table, that sends out an email whenever an insert happens.

See here for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM