JAVA、PHP、前端、APP、网站开发 - 开发技术学习

开发技术学习 » 数据库 » mysql清除注释

mysql清除注释

此文被围观554日期: 2021-12-13 分类 : 数据库  标签:  ··

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;


来源:https://blog.csdn.net/weixin_38351566/article/details/118694521

站点声明:部分内容源自互联网,为传播信息之用,如有侵权,请联系我们删除。

© Copyright 2011-2024 www.kfju.com. All Rights Reserved.
超级字帖 版权所有。蜀ICP备12031064号