what is the proper sql syntax for making an existing column in a table to autoincrement? the table is already populated. the column is already primary key. I tried alter table dba.transaction alter transaction_ID AUTOINCREMENT and alter table dba.transaction alter transaction_ID BigInt AUTOINCREMENT but both failed asked 09 Nov '13, 23:42 G_G |
I found the answer by using sybase central gui: alter the column in the target table for the autoincrement right click on the column and copy, paste to notepad and change the add to alter. voila: ALTER TABLE "dba"."transaction" alter "trans_ID" BIGINT NOT NULL DEFAULT AUTOINCREMENT answered 09 Nov '13, 23:48 G_G That's expected behaviour: AUTOINCREMENT is not a data type (say, other than IDENTITY or TIMESTAMP in MS SQL, AFAIK) but a column default, and so the syntax is the one to add/alter a default, as can been seen in the docs: Here, cf. the "ALTER column-name column-alteration" clause.
(10 Nov '13, 16:09)
Volker Barth
|