I’m using a trigger concept when a row from a table is deleted the same row is to be inserted into another table.. Now the problem is i am deleting the row from grid view using delete command field. when i delete the row i couldn’t get the values of the deleted row to make it store in another table. the row is getting inserted but it’s all empty.
Now i need to know how to copy the values from deleted row into another table for insertion.
require help as soon as possible
Thank you.
this is the trigger
No this is my trigger function.
CREATE TRIGGER tgrfortrash ON [dbo].[Proj_details]
AFTER DELETE
AS
declare @proj_id varchar(10);
declare @proj_name varchar(100);
declare @front_end varchar(15);
declare @back_end varchar(15);
declare @proj_path varchar(100);
select @proj_id=d.Proj_id from deleted d;
select @proj_name=d.Proj_name from deleted d;
select @front_end=d.Front_end from deleted d;
select @back_end=d.Back_end from deleted d;
insert into Trash_details
(Proj_id,Proj_name,Front_end,Back_end,Proj_path)
values(@proj_id,@proj_name,@front_end,@back_end,@proj_path);
You can make sue of magic table in you delete trigger and get the whole deleted row
here is the statement for that
EDIT
why you are using the variable for each value you can write it like this
there is no need to variables