use information_schema;
select
CONCAT('ALTER TABLE `'
,table_schema,'`.`'
,table_name,'`'
,' CHANGE COLUMN '
,'`',column_name,'` `' -- source col name
,column_name,'` ' -- change col name
,' INT(10) ' -- type
,if(is_nullable='no',' NOT NULL ','')
,' ',EXTRA
,' COMMENT \'',COLUMN_COMMENT,'\';'
)
from columns where table_schema = 'isuzu1008'
and column_type = 'int(11)' and column_name like '%id%';
select
CONCAT('ALTER TABLE `'
,table_schema,'`.`'
,table_name,'`'
,' CHANGE COLUMN '
,'`',column_name,'` `' -- source col name
,column_name,'` ' -- change col name
,' INT(10) ' -- type
,if(is_nullable='no',' NOT NULL ','')
,' ',EXTRA
,' COMMENT \'',COLUMN_COMMENT,'\';'
)
from columns where table_schema = 'isuzu1008'
and column_type = 'int(11)' and column_name like '%id%';