db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajesh Kartha <karth...@gmail.com>
Subject Re: reset SM_ID value
Date Sun, 24 Sep 2006 17:05:33 GMT
Hi,

A new feature has been added to ALTER TABLE syntax. and is available in the
upcoming 10.2 release.
see - http://issues.apache.org/jira/browse/DERBY-783

This 10.2 feature is documented at - 
http://db.apache.org/derby/docs/10.2/ref/rrefsqlj81859.html

There is more info on 10.2 (beta) at:
http://wiki.apache.org/db-derby/TenTwoRelease

including release candidate download location.

-Rajesh

Pedro Dinis wrote:

> I’ve a table which has lots of inserts and deletes (400 
> inserts/second) and where primary key is something like this:
>
> CREATE TABLE WORK2 (
>
> SM_ID INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, 
> INCREMENT BY 1),
>
> MID VARCHAR(32),
>
> (…)
>
> );
>
> With this kind of primary key definition I know that will be a time 
> when the column SM_ID will reach the maximum value that a Java int 
> value can have- 2147483647 (//java.lang.Integer.MAX_VALUE//) .
>
> So how can I resolve this problem?
>
> I know that this table , WORK2, from time to time will be totally 
> empty, so my first idea was to reset the counter that SM_ID column is 
> using back to 1 when the table has no lines. This way, next new line 
> to be inserted on WORK2 will have SM_ID = 1…. But I don’t know how to 
> do this via JDBC.
>
> Many thanks,
>
> P.Dinis.
>


Mime
View raw message