SELECT
CONCAT(
'alter table ',
table_name,
' MODIFY COLUMN ',
column_name,
' float DEFAULT NULL;'
) AS col,
TABLE_NAME,
COLUMN_NAME,
DATA_TYPE
FROM
INFORMATION_SCHEMA.columns a
WHERE TABLE_SCHEMA = 'prod_db' -- 代表所在的数据库
AND data_type IN ('double') -- 批量修改的类型
mysql批量修改列类型-生成语句
最新推荐文章于 2024-08-23 17:16:27 发布