举例,批量修改库中创建人字段的类型为字符串类型,长度80.
1.查出库中相关表信息
SELECT
table_name,
COLUMN_NAME,
DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH,
COLUMN_COMMENT ,
CONCAT( 'ALTER TABLE ' ,table_name ,' CHANGE ', COLUMN_NAME ,' ', COLUMN_NAME , ' VARCHAR(80) NULL COMMENT "创建人"' ,';')
FROM
information_schema.COLUMNS
WHERE
table_name LIKE 'wf%'
AND COLUMN_NAME LIKE 'update_user_id';
然后复制所以sql执行即可