1:查询出需要的列名 备用

#列名
select COLUMN_NAME from information_schema.columns
where TABLE_SCHEMA='yunpiaobox_db' and table_name='t_box_status'

 

TABLE_SCHEMA: 数据库名称    table_name:表名


#列名字符串 按,分隔
select
GROUP_CONCAT(COLUMN_NAME separator ',') '逗号分隔',
GROUP_CONCAT(CONCAT('NEW.', COLUMN_NAME) separator ',') 'NEW.字段 逗号分隔',
GROUP_CONCAT(CONCAT(COLUMN_NAME, '=NEW.', COLUMN_NAME) separator ',') '字段=NEW.字段 逗号分隔'
from information_schema.columns
where TABLE_SCHEMA='yunpiaobox_db' and table_name='t_box_status'

 

2:工具Navicat Premium 右击A表  ---> 设计表 --->  选择触发器

 

posted on 2017-09-21 10:55  1161588342  阅读(316)  评论(0编辑  收藏  举报