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

 

posted @ 2020-12-15 09:56  秋香姑娘请你不要紧张  阅读(867)  评论(0编辑  收藏  举报