时间:2021-07-01 10:21:17 帮助过:108人阅读
禁止修改数据库中的某一列语句
防止userinfo 表中的name,age,tel,fax 等字段被撰改
ROPTRIGGERIFEXISTS`userinfo`;
SET@OLD_SQL_MODE=@@SQL_MODE,SQL_MODE='';
DELIMITER//
CREATETRIGGER`userinfo`BEFOREUPDATEON`userinfo`FOREACHROWBEGIN
setnew.name=old.name;
setnew.member_id=old.member_id;
setnew.age=old.age;
setnew.tel=old.tel;
setnew.fax=old.fax;
END//
DELIMITER;
SETSQL_MODE=@OLD_SQL_MODE;
/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
bitsCN.com