我已經繼承了啓用了'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