Trigger to back up the deleted data in another table

Ddd
Posted by Ddd under Sql Server category on | Points: 40 | Views : 3892
/*emp has 3 columns
eno,ename,salary

create another table emp1*/
select * into emp1 from emp where 1=2


create trigger trg on emp for delete
as
insert emp1 select * from deleted


--Test the Trigger
delete from emp where eno=445(say)

The row wil be copied into emp1 through the deleted table

Comments or Responses

Login to post response