mysql DDL操作增加列数据异常

遇到一个有点诡异的问题,想给mysql增加列,语句如下:

#板块 - 新增全屏广告位(点击)字段
ALTER TABLE `lanrch_panel` ADD COLUMN `monitorClick` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '广告海报点击时信息URL列表' AFTER `description`;
ALTER TABLE `lanrch_panel_log` ADD COLUMN `monitorClick` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '广告海报点击时信息URL列表' AFTER `description`;
ALTER TABLE `lanrch_panel_pre` ADD COLUMN `monitorClick` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '广告海报点击时信息URL列表' AFTER `description`;
ALTER TABLE `lanrch_panel_service` ADD COLUMN `monitorClick` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '广告海报点击时信息URL列表' AFTER `description`;
#板块 - 新增全屏广告位(显示)字段
ALTER TABLE `lanrch_panel` ADD COLUMN `monitorShow` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '广告海报显示时信息URL列表' AFTER `description`;
ALTER TABLE `lanrch_panel_log` ADD COLUMN `monitorShow` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '广告海报显示时信息URL列表' AFTER `description`;
ALTER TABLE `lanrch_panel_pre` ADD COLUMN `monitorShow` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '广告海报显示时信息URL列表' AFTER `description`;
ALTER TABLE `lanrch_panel_service` ADD COLUMN `monitorShow` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '广告海报显示时信息URL列表' AFTER `description`;
#板块 - 新增门户显示的图标类型字段
ALTER TABLE `lanrch_panel` ADD COLUMN `iconNew` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '三期门户显示的图标' AFTER `description`;
ALTER TABLE `lanrch_panel_log` ADD COLUMN `iconNew` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '三期门户显示的图标' AFTER `description`;
ALTER TABLE `lanrch_panel_pre` ADD COLUMN `iconNew` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '三期门户显示的图标' AFTER `description`;
ALTER TABLE `lanrch_panel_service` ADD COLUMN `iconNew` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '三期门户显示的图标' AFTER `description`;
#板块 - 新增门户显示的图标类型字段
ALTER TABLE `lanrch_panel` ADD COLUMN `iconType` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '门户显示的图标类型' AFTER `description`;
ALTER TABLE `lanrch_panel_log` ADD COLUMN `iconType` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '门户显示的图标类型' AFTER `description`;
ALTER TABLE `lanrch_panel_pre` ADD COLUMN `iconType` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '门户显示的图标类型' AFTER `description`;
ALTER TABLE `lanrch_panel_service` ADD COLUMN `iconType` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '门户显示的图标类型' AFTER `description`;

monitorClick和monitorShow可以正常插入,iconNew和iconType就不行

报以下错误:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''涓夋湡闂ㄦ埛鏄剧ず鐨勫浘鏍? AFTER `description`' at line 1

诡异就诡异在,有些能插入有些不能,并且如果单条执行,是可以插入的,那说明不是脚本有问题

那会是什么问题呢?  相信细心的你已经发现了,这里面有乱码,说明是汉字的字符编码有问题

解决办法:将描述改为非汉字,或者,去其他没有问题的脚本拷贝汉字过来修改。

执行结果:

Query OK, 14 rows affected
Records: 14  Duplicates: 0  Warnings: 0

Query OK, 215 rows affected
Records: 215  Duplicates: 0  Warnings: 0

Query OK, 24848 rows affected
Records: 24848  Duplicates: 0  Warnings: 0

Query OK, 14 rows affected
Records: 14  Duplicates: 0  Warnings: 0

Query OK, 146 rows affected
Records: 146  Duplicates: 0  Warnings: 0

 

你可能感兴趣的:(数据库)