Thanks Kristian I need to nest the query ALTER TABLE myTable ALTER myIdentityColumn RESTART WITH 2000 like ALTER TABLE myTable ALTER myIdentityColumn RESTART WITH (select max(myIdentityColumn) from myTable +1 ) How can i do it ?
Kristian Waagan wrote: > > 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 > > -- View this message in context: http://www.nabble.com/Database-identity-column-tf2692150.html#a7508996 Sent from the Apache Derby Users mailing list archive at Nabble.com.
