我已经继承了启用了'unique auto_identity index'选项的Sybase数据库。作为升级过程的一部分,我需要一些额外的列在这个数据库添加到表即将列添加到具有唯一auto_identity索引选项的sybase表中
alter table mytable add <newcol> float default -1 not null
当我尝试这样做,我得到了如下错误:
Column names in each table must be unique, column name SYB_IDENTITY_COL in table #syb__altab....... is specifed more than once
是否有可能在启用此属性的情况下将列添加到表中?
更新1:
我创建了下面的测试复制问题:
use master
sp_dboption 'esmdb', 'unique auto_identity indexoption',true
use esmdb
create table test_unique_ids (test_col char)
alter table test_unique_ids add new_col float default -1 not null
alter table命令在这里产生错误。
更新(已在ASE 15/Solaris和15.5/Windows的尝试这样做)2:
这是在Sybase DBISQL界面中的错误,该客户端工具Sybase Central和Interactive SQL使用到访问数据库,并且它只会启用“唯一auto_identity索引”选项而影响表格。
要解决该问题,请使用不同的SQL客户端(例如,通过JDBC)连接到数据库,或在命令行上使用isql。
我更新了原始的一些示例代码,产生了错误。 – tja 2010-11-11 15:51:32
@tja:回应 – PerformanceDBA 2010-11-12 22:44:51
是一个错误,请参阅更新2。 – tja 2010-11-23 17:18:54