Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Add Identity column with seed to existing table

2 posts in General Discussion Last posting was on 2012-10-02 15:22:53.0Z
Sean Posted on 2012-10-02 09:45:44.0Z
Sender: 5da.506ab5be.1804289383@sybase.com
From: Sean
Newsgroups: sybase.public.ase.general
Subject: Add Identity column with seed to existing table
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <506ab7c8.626.1681692777@sybase.com>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 2 Oct 2012 02:45:44 -0700
X-Trace: forums-1-dub 1349171144 172.20.134.41 (2 Oct 2012 02:45:44 -0700)
X-Original-Trace: 2 Oct 2012 02:45:44 -0700, 172.20.134.41
Lines: 7
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:31400
Article PK: 74289

I want to add an identity column with seed to an existing
table.

How do I implement this in Adaptive Server Anywhere 9 and
SQL Anywhere 12.

Thanks


Sean Posted on 2012-10-02 15:22:53.0Z
Sender: 1747.506b03e2.1804289383@sybase.com
From: Sean
Newsgroups: sybase.public.ase.general
Subject: Re: Add Identity column with seed to existing table
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <506b06cd.1836.1681692777@sybase.com>
References: <506ab7c8.626.1681692777@sybase.com>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 2 Oct 2012 08:22:53 -0700
X-Trace: forums-1-dub 1349191373 172.20.134.41 (2 Oct 2012 08:22:53 -0700)
X-Original-Trace: 2 Oct 2012 08:22:53 -0700, 172.20.134.41
Lines: 21
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:31406
Article PK: 74295


> I want to add an identity column with seed to an existing
> table.
>
> How do I implement this in Adaptive Server Anywhere 9 and
> SQL Anywhere 12.
>
> Thanks

OK, so I've found a workaround.
You can set up the new column with:
alter table source
add NewID numeric(7,0)
identity not null

This can then be simply UPDATED with:
update source
set NewID = NewID + @MyOffsetNr

where @MyOffsetNr is previously declared/set.

This gave me what I desired.