Hi friends,
Pls, Help me..
How to create trigger Procedure. I want to delete record one table the same value should be dynamically save in another table.
How to create the trigger procedure. Give me sample trigger procedure
Thanks
Hi friends,
Pls, Help me..
How to create trigger Procedure. I want to delete record one table the same value should be dynamically save in another table.
How to create the trigger procedure. Give me sample trigger procedure
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
shiva krishnaPosted Sep 27, 2008, 12:50 AM
kavitha mPosted Aug 27, 2008, 1:12 AM
Hi Satish Kathi ,
Given trigger procedure working fine. You given me exact coding. Thanks a lot
keep on answer my question. once again Thanks
Satish KathiPosted Aug 26, 2008, 5:20 PM
Here is the sample code, when you delete from table1 trigger will insert the values in table2.
Hope this helps
create trigger tD_tD_tabl1 on table1 for DELETE
as
begin
declare
@da nvarchar(10),
@db nvarchar(10)
declare mycursor cursor for select a, b from deleted
open mycursor
fetch mycursor into @da, @db
while @@fetch_status <> -1
BEGIN
if @@fetch_status <> -2
BEGIN
insert into table2 (c,d) values(@da, @db)
END
fetch mycursor into @da, @db
END
close mycursor
end