mysql清除注释代码
SELECT concat( 'alter table ', table_schema, '.', table_name, ' modify column ', column_name, ' ', column_type, ' ', IF ( is_nullable = 'YES', IF ( data_type IN ('timestamp'), ' null ', ' ' ), 'not null ' ), IF ( column_default IS NULL, '', IF ( data_type IN ('char', 'varchar') OR data_type IN ('date', 'datetime') AND column_default != 'CURRENT_TIMESTAMP', concat( ' default ''', column_default, '''' ), concat( ' default ', IF ( column_default = '', '''''', column_default ) ) ) ), IF ( extra IS NULL OR extra = '', '', concat(' ', extra) ), ' comment ''', ''';' ) s FROM information_schema. COLUMNS WHERE table_schema = '数据库名称';
清除表注解
SELECT
concat(
'alter table ',
table_schema,
'.',
table_name,
' comment ''',
''';'
) s
FROM
information_schema. COLUMNS
WHERE
table_schema = '数据库名称'
GROUP BY
TABLE_NAME;