Alter multiple columns in a single statement [dupl

2019-03-17 03:09发布

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?

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

1条回答
Melony?
2楼-- · 2019-03-17 03:24

The documentation suggests you can chain alter_specifications with a comma:

ALTER TABLE `media_value_report` 
    CHANGE col1_old col1_new varchar(10),
    CHANGE col1_old col1_new varchar(10),
    ...
查看更多
登录 后发表回答