使用单个查询在netezza中重命名两列

时间:2015-02-05 05:06:19

标签: multiple-columns rename netezza alter

我是netezza的新手。我需要知道如何使用单个查询重命名两列。

我试过了,

ALTER TABLE tabemp RENAME COLUMN salary to empsalary and name to empname;

ALTER TABLE tabemp RENAME COLUMN salary to empsalary , name to empname;

但这些都不起作用。

感谢。

2 个答案:

答案 0 :(得分:2)

使用查询,一次只能重命名一列。您可以编写包装器脚本来重命名多个列,或使用IBM Netezza Performance门户来编辑表。检查链接here

答案 1 :(得分:1)

您只能使用ALTER TABLE重命名一列。

From the documentation, which can be found at this link,您可以看到ADD COLUMN是唯一允许多种规格的动作:

ALTER TABLE <table> <action> [ORGANIZE ON {(<columns>) | NONE}]

Where <action> can be one of:

ADD COLUMN <col> <type> [<col_constraint>][,…] |  

ADD <table_constraint> |  

ALTER [COLUMN] <col> { SET DEFAULT <value> |  DROP DEFAULT } |  

DROP [COLUMN] column_name[,column_name…] {CASCADE | RESTRICT } |  

DROP CONSTRAINT <constraint_name> {CASCADE | RESTRICT} | 

MODIFY COLUMN (<col> VARCHAR(<maxsize>)) |  

OWNER TO <user_name> | 

RENAME [COLUMN] <col> TO <new_col_name> | 

RENAME TO <new_table> |  

SET PRIVILEGES TO <table>
相关问题