禁止修改数据库中的某一列

 

http://netkiller.github.io/mysql

 

防止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 */; 

你可能感兴趣的:(sql,mysql,trigger,netkiller)