Click here to Skip to main content
15,917,991 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello ,


my problem is this--
when any row inserted in a table then i want to fire trigger and send mail to respective person mail id.

table name: rowInserted
mail to: shg@hmau.com
mail from : hghg@jh.com

Thanks
Shubham Gupta
Posted
Updated 23-Feb-15 1:56am
v2

USE yourdatabase
IF EXISTS (SELECT name FROM sysobjects
      WHERE name = 'MailToCustomerTr' AND type = 'TR')
   DROP TRIGGER MailToCustomerTr
GO
CREATE TRIGGER MailToCustomerTr
ON rowInserted
FOR INSERT
AS
   EXEC sp_send_dbmail  @recipients = 'shg@hmau.com'
   
GO
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900