【MySQL】批量修改排序规则
select
concat('ALTER TABLE `', TABLE_NAME, '` MODIFY COLUMN `', COLUMN_NAME, '` ', COLUMN_TYPE, ' CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ', if(IS_NULLABLE = 'YES', 'NULL', 'NOT NULL'), ' DEFAULT ',if(COLUMN_DEFAULT = '', '\'\'', 'NULL'), ' COMMENT ', COLUMN_COMMENT, ';') as modifySql
from `COLUMNS`
where
TABLE_SCHEMA ='库名称'
and TABLE_NAME not like 'act_%'
and CHARACTER_SET_NAME is not null
and COLLATION_NAME != 'utf8mb4_general_ci'
order by TABLE_NAME asc