IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_schema=CurrentDatabase AND table_name = 'rtc_order'AND column_name = 'IfUpSend') THEN
ALTER TABLE rtc_order
ADD COLUMN `IfUpSend` BIT NOT NULL DEFAULT 0 COMMENT '是否上传 是否上传';
ENDIF;
END//
DELIMITER ;
CALL schema_change();
mysql 判断字段否存在,如果存在就修改字段:
1
2
3
4
5
6
7
DROP PROCEDURE IF EXISTS proc_tempPro;
if(@count>0) THEN
alter table 表名 change column `旧列名` `新列名` varchar(30) comment '字段说明';