The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

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:

×25
×10
×9

question asked: 09 Nov '13, 23:42

question was seen: 4,057 times

last updated: 10 Nov '13, 16:09