table student(
id, name,age)
table temp(
id , temp_id)
想写一个del触发器,当表student里的行被删除时,将student.ID号保存(insert)在temp表temp_id里,请大虾帮忙写下
------解决思路----------------------
create trigger tr_student
on student
after delete
as begin
insert into temp(temp_id)
select id from deleted
end
------解决思路----------------------
Create trigger DeleteStudent
ON [dbo].[student]
FOR DEETE
BEGIN
BEGIN TRANSACTION
insert into temp(temp_id)
select ID from deleted
if @@rowcount > 0
commit transaction
else
rollback transaction
END