SQLTeam.com | Weblogs | Forums

Database mail

sql2008r2

#1

Hi guys,

I have to write a trigger, I have status approval table when there is status update from inactive to active or inactive to rejected, this trigger should fire.
the table structure for storing email is as below:
create table tbl_emaildetails
(
ID int not null identity(1,1),
Template varchar(max),
sender_event_type varchar(50),
user_profile_id int not null
)

sp to get the Template text and email address is as below:
create procedure sp_emaildetails_view

@profileid int

AS

select
Template ,
Email

from
tbl_emaildetails A,
tbl_person B

where
user_profile_id=@profileid
and A.user_profile_id=B.ID
can any one suggest me how to write trigger for the above scenario.

Thanks & Regards,
Kiran


#2

create an trigger for update.
in the trigger use the statement
select status from inserted where status in ('active', 'rejected')
and
select status from deleted where status ='active'