1. 程式人生 > >mysql批量更改欄位排序規則

mysql批量更改欄位排序規則

在information_schema資料庫中執行,生成批量sql

#批量更改欄位排序規則

SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', DATA_TYPE, '(', CHARACTER_MAXIMUM_LENGTH, ') CHARACTER SET UTF8 COLLATE utf8_general_ci',  ';')
FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='gyy' and DATA_TYPE='varchar' and COLLATION_NAME='utf8_unicode_ci';