Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have two tables table1 and table2

Table1
id,name,age, date and serial number
table2
data1 and data2
so i want to use trigger on table1 and if any one wants to insert/update and delete on table1 so a new message should be generate and that message should be save into table2
how it can be possible if i am using trigger .....please guide me
Posted

 
Share this answer
 
Hey,
use this trigger

SQL
ALTER TRIGGER [dbo].[InsertMessage]
ON [dbo].[Table1]
AFTER INSERT,DELETE,UPDATE
AS
BEGIN
    insert into table2(data1,data2) values('Message1','Message2')

END

best luck
 
Share this answer
 
v2

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