动态将表中的列名全部转换成小写
/* 动态将表的列名改为小写 */ select concat_ws('','alter table ',a.TABLE_NAME,' modify ',lower(a.COLUMN_NAME),' ',a.Column_type, case when a.is_nullable = 'NO' THEN ' not null ' else null end, case when a.Column_default is null then null when a.Column_default = '' then ' default ''''' when a.Column_default is not null and a.data_type in ('bigint','int','decimal') then concat_ws('',' default ',a.Column_default) when a.Column_default is not null and a.data_type in ('varchar','char') then concat_ws('',' default ','''',a.Column_default,'''') when a.Column_default is not null and a.data_type in ('timestamp','datetime') then concat_ws('',' default ',a.Column_default) else null end ,' comment ''',a.Column_comment,'''',';') aa from information_schema.`COLUMNS` a where a.TABLE_SCHEMA ='ibgs' and a.TABLE_NAME ='sys_config';