db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: Database identity column
Date Thu, 23 Nov 2006 13:13:11 GMT
jatintrivedi wrote:
> I have exported a sybase db and mapped it to Derby. 
> Derby creates the corresponding data and schema xml. 
> One of the table has 20 rows and an auto-incremet primary key.
> When i migrate my application to derby and try to insert new row it starts
> with primary key id as 1 
> which causes an exception (unique constraint).
> How can i maintain the primary key after migrating to derby 

Hi,

What version of Derby are you using?

If you're using 10.2, you can use the ALTER TABLE statement to restart 
the identity column. Have a look in the reference manual.

As an example:
ALTER TABLE myTable ALTER myIdentityColumn RESTART WITH 2000



HTH,
--
Kristian

Mime
View raw message