mysql 批量修改表列明为大小写
根据表名 修改为小写
SELECT concat( 'alter table ', TABLE_NAME, ' change column ', COLUMN_NAME, ' ', LOWER( COLUMN_NAME ), ' ', COLUMN_TYPE, ' comment \'', COLUMN_COMMENT, '\';' ) AS '修改脚本' FROM information_schema.COLUMNS WHERE TABLE_NAME = '表名';
根据库名 修改为小写
SELECT concat( 'alter table ', TABLE_NAME, ' change column ', COLUMN_NAME, ' ', LOWER( COLUMN_NAME ), ' ', COLUMN_TYPE, ' comment \'', COLUMN_COMMENT, '\';' ) AS '修改脚本' FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '数据库名'
大写的话 把 LOWER 改成 UCASE