Maxcompute修改列名

339 阅读1分钟

修改列名及注释

修改非分区表或分区表的列名或注释。

  • 命令格式

    alter table <table_name> change column <old_col_name> <new_col_name> <column_type> comment '<col_comment>';
    
  • 参数说明

    • table_name:必填。需要修改列名以及注释的表名称。
    • old_col_name:必填。需要修改的列名称。old_col_name必须是已存在的列。
    • new_col_name:必填。新的列名称。表中不能有名为new_col_name的列。
    • column_type:必填。列的数据类型。
    • col_comment:可选。修改后的注释信息。内容最长为1024字节。
  • 使用示例

    --修改表sale_detail的列名customer_name为customer_newname,注释“客户”为“customer”。
    alter table sale_detail change column customer_name customer_newname STRING comment 'customer';