- 论坛徽章:
- 0
|
环境:RedHat Enterprise Linux AS4 + DB2 V9.5
建表脚本如下:DROP TABLE s_ds_proj;
CREATE TABLE s_ds_proj
(
ds_project_name varchar(1024) NOT NULL DEFAULT ' ' primary key ,
ds_server_id integer NOT NULL DEFAULT 0 ,
app_id integer NOT NULL DEFAULT 0 ,
ds_project_stat integer NOT NULL DEFAULT 0 ,
stat_msg1 varchar(128) NOT NULL DEFAULT ' ' ,
stat_msg2 varchar(2048) NOT NULL DEFAULT ' ' ,
ext_column_1 integer NOT NULL DEFAULT 0 ,
ext_column_2 integer NOT NULL DEFAULT 0 ,
ext_column_3 varchar(256) NOT NULL DEFAULT ' ' ,
ext_column_4 varchar(256) NOT NULL DEFAULT ' '
);
|
报错如下:
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0613N The primary key, unique key, or table partitioning key identified by
"DS_PROJECT_NAME..." is too long or has too many columns. SQLSTATE=54008
大意就是:主健或UNIQUE约束太长或者包含了太多的列
但是把其中stat_msg1的字段长度调整为2048就可以创建成功。或者增加几个字段也可以创建成功,
这是什么原因,难道主键长度和非主键的长度必须达到一定比例才行? |
|