Home > Database > Mysql Tutorial > 禁止修改数据库中的某一列语句_MySQL

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:34:53
Original
1184 people have browsed it

bitsCN.com

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

 

防止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
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template