ALTER TABLE RENAME COLUMN is not supported in DB2 V9.1 or later version.

今天居然发现了DB2 资料的错误。

在DB2 redbook上,有如下表述:

ALTER TABLE table-name
(1) (2) (3)
ADD column-definition
unique-constraint
referential-constraint
check-constraint
add-partition
partitioning-clause
RESTRICT ON DROP
(4)
CLONE clone-table-name
ALTER column-alteration
partition-alteration
ROTATE partition-rotation
DROP PRIMARY KEY
FOREIGN KEY constraint-name
UNIQUE
CHECK
CONSTRAINT
RESTRICT ON DROP
(4)
CLONE
VALIDPROC program-name
NULL
AUDIT NONE
CHANGES
ALL
DATA CAPTURE NONE
CHANGES
CARDINALITY
NOT VOLATILE
VOLATILE
APPEND NO
YES
MATERIALIZED
QUERY
ADD materialized-query-definition
MATERIALIZED
DROP QUERY
MATERIALIZED
ALTER QUERY materialized-query-table-alteration
(4)
RENAME COLUMN source-column-name TO target-column-name

然而,经过多次尝试,最终确定以上不被DB2支持。

(I found the command is completed unavailable in DB2, no matter LUW or z/OS environment)

If you are using DB2 9 for z/OS, it is possible with lots of restrictions. (Make it almost useless, but the importance is this is the first step)

The statement is ALTER TABLE RENAME COLUMN. And the restrictions:
The RENAME COLUMN keyword cannot be used in one statement with any other ALTER TABLE options.
The RENAME COLUMN keyword cannot be repeated within one ALTER TABLE statement.
ALTER TABLE RENAME COLUMN is not allowed when the source column is referenced in a view.
If you try to run ALTER TABLE RENAME COLUMN for a table that has a trigger defined on it, the attempt results in SQLCODE -750.
You cannot use ALTER TABLE RENAME COLUMN if the table is referenced in a Materialized Query Table (MQT).
ALTER TABLE RENAME COLUMN is not allowed if the source column has a check constraint or a field procedure defined on it.
ALTER TABLE RENAME COLUMN is not allowed if the table containing the column has a valid or edit procedure defined on it.
ALTER TABLE RENAME COLUMN is not allowed if the source column has an index defined on it.
You cannot rename a column if there is an index on expression or spatial index depends on the column.
You cannot alter any column of the DB2 catalog.

相关链接:

http://www.itpub.net/archiver/tid-1087480.html

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21018850/viewspace-1020179/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/21018850/viewspace-1020179/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值