select
concat(
'alter table ',
TABLE_SCHEMA,
'.',
TABLE_NAME,
' modify column ',
COLUMN_NAME,
' varchar(64) ',
' not null default \'\' ',
' comment \'',
COLUMN_COMMENT,
'\';'
)
from
information_schema.COLUMNS
where
DATA_TYPE = 'varchar'
and CHARACTER_MAXIMUM_LENGTH = 32
and TABLE_SCHEMA = 'test';
select concat('update ',TABLE_SCHEMA,'.',TABLE_NAME,' set ',COLUMN_NAME,' = ''''', ' where ' ,COLUMN_NAME, ' is null;')
from information_schema.COLUMNS where DATA_TYPE='varchar' and CHARACTER_MAXIMUM_LENGTH=32 and TABLE_SCHEMA='test';