当您更改表时,如何检测列的数据类型?

发布于 2024-09-16 17:25:49 字数 184 浏览 1 评论 0原文

我正在运行 MySQL,我需要将某些列的数据类型从枚举更改为整数。然而,有很多列。 (如果存在)同时更改所有枚举列的语法是什么。以下是我更新单个列以使其成为整数数据类型的方法:

ALTER TABLE table_name CHANGE column_name column_name INTEGER;

I am running MySQL and I need to change the data type of certain columns from an enumeration to integer. However, there are a lot of columns. (If this exists) What is the syntax to alter all columns at the same time that are enumerations. Here is how I am updating a single column to make it integer data type:

ALTER TABLE table_name CHANGE column_name column_name INTEGER;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

勿忘初心 2024-09-23 17:25:49

SHOW COLUMNS FROM WHERE TYPE LIKE "%enum%"

之后您可以迭代结果,类似于此处描述的解决方案:
https://www.php.net/manual/ en/function.mysql-fetch-field.php#92069
希望这有帮助,
迈克尔

SHOW COLUMNS FROM WHERE TYPE LIKE "%enum%"

you could afterwards iterate through your result similar to the solution described here:
https://www.php.net/manual/en/function.mysql-fetch-field.php#92069
hope this helps,
Michael

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文