| student | CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(20) DEFAULT NULL, `name` varchar(20) DEFAULT NULL, `sex` varchar(20) DEFAULT NULL, `age` int(2) DEFAULT NULL, `dept` varchar(20) DEFAULT NULL, `times` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 |
create trigger ceshia1 after update on t_student for each ROW
BEGIN
select stu_id,stu_code,stu_name,stu_sex,age,stu_dept,NOW()
into @v8,@v1,@v2,@v3,@v4,@v5,@v6 from t_student where stu_id=old.stu_id;
insert into student values(@v8,@v1,@v2,@v3,@v4,@v5,@v6);
end;
原文:http://www.cnblogs.com/mengluo/p/5428165.html