lqxue

常用链接

统计

book

tools

最新评论

mysql 创建触发器

语法结构类似

DELIMITER $$;

DROP TRIGGER `log`$$

CREATE TRIGGER `log` BEFORE/AFTER INSERT/UPDATE/DELETE on `user`
FOR EACH ROW BEGIN

END$$

DELIMITER ;$$

具体例子:
删除:

DELIMITER $$;

DROP TRIGGER `log`$$

CREATE TRIGGER `log` AFTER DELETE on `user`
FOR EACH ROW BEGIN
insert into userLog (useroid,userAccount,pwd,userType,companyInfoOid,personalInfoOid,
status,regDate,email) values (old.oid,old.userAccount,old.pwd,old.userType,old.companyInfoOid,old.personalInfoOid,old.status,old.regDate,old.email);

END$$

DELIMITER ;$$

如果是修改/的话,old应该是new

posted on 2007-09-07 11:42 lqx 阅读(489) 评论(0)  编辑  收藏 所属分类: database


只有注册用户登录后才能发表评论。


网站导航: