【发布时间】:2015-03-02 01:26:58
【问题描述】:
我想将 sql 表 TB_TRANSACTION 中的 EN_NO 长度从 21 更改为 16。以下是我当前的 sql 列字段。
sql 命令 -
describe table tb_transaction
column | type schema | type name | length | scale | nulls
EN_NO| SYSIBM | VARCHAR | 21 | 0 | Yes
我尝试使用此命令但失败了。
alter table tb_transaction alter column EN_NO set data type varchar(16)<br/>
Error message:
SQL0190N ALTER TABLE "EASC.TB_TRANSACTION" specified attributes for column
"EN_NO" that are not compatible with the existing column. SQLSTATE=42837
任何帮助将不胜感激。
【问题讨论】:
-
该列中最长值的长度是多少?
-
当前该列只有1条数据,
POLICY100210长度 -
你能做 4 部分过程吗?添加新列,从旧更新新列,删除旧列,重命名新列?
-
尝试“从 tb_transaction 中选择 cast(EN_NO as varchar(16))”。会发生什么?
-
什么平台和版本的 DB2?它适用于我的 DB2 for i 7.1。我确实收到一条消息,“更改字段 EN_NO 可能会导致数据丢失。”。但我可以忽略这一点并更改表格。