Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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's gravatar image

G_G
46339
accept rate: 0%


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

permanent link

answered 09 Nov '13, 23:48

G_G's gravatar image

G_G
46339
accept rate: 0%

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:

ALTER TABLE

Here, cf. the "ALTER column-name column-alteration" clause.

(10 Nov '13, 16:09) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×34
×10
×10

question asked: 09 Nov '13, 23:42

question was seen: 8,171 times

last updated: 10 Nov '13, 16:09