在一条语句中修改多个列[重复]

时间:2021-05-10 09:29:08

This question already has an answer here:

这个问题已经有了答案:

I am using a query to alter the charset of a column

我正在使用查询来更改列的字符集

ALTER TABLE `media_value_report` 
    CHANGE `index_page_body` `index_page_body` TEXT CHARACTER  
    SET utf8 NULL DEFAULT NULL

i want to do this for other columns main_title, landing_page_body as well. But am getting a #1064 error while executing. Can i alter-change multiple columns in a single query?

我想对其他列main_title、landing_page_body也这样做。但是在执行过程中会出现#1064错误。我可以在一个查询中更改多个列吗?

I tried but i found in goog search that is not possible to alter in a single query.

我试过了,但在好的搜索中,我发现在一个查询中是不可能改变的。

1 个解决方案

#1


67  

The documentation suggests you can chain alter_specifications with a comma:

文档建议您可以用逗号链接alter_specification:

ALTER TABLE `media_value_report` 
    CHANGE col1_old col1_new varchar(10),
    CHANGE col1_old col1_new varchar(10),
    ...

#1


67  

The documentation suggests you can chain alter_specifications with a comma:

文档建议您可以用逗号链接alter_specification:

ALTER TABLE `media_value_report` 
    CHANGE col1_old col1_new varchar(10),
    CHANGE col1_old col1_new varchar(10),
    ...