Add an identity colum

View: New views
4 Messages — Rating Filter:   Alert me  

Add an identity colum

by Andre Rothe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

How I can add an identity column to an existing table?
I have a datatore where I have to alter some tables. It
seems not possible to alter an existing column (datatype
integer) into an identity column. Can I add such a
new column?

Tanks
Andre


Re: Add an identity colum

by Rick Hillegas-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi André,

Currently, Derby does not let you add an identity column to a table. It
is a disabled feature. There is an outstanding JIRA for re-enabling this
capability: DERBY-3888. I suspect that it is not a lot of work. I am
sure that the community would give you lots of advice if you decided to
tackle this issue yourself. Alternatively, if enough people vote for
this issue, it would percolate to the top of our to-do list.

Thanks,
-Rick

André Rothe wrote:

> Hi,
>
> How I can add an identity column to an existing table?
> I have a datatore where I have to alter some tables. It
> seems not possible to alter an existing column (datatype
> integer) into an identity column. Can I add such a
> new column?
>
> Tanks
> Andre
>


RE: Add an identity colum

by Derby-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


But surely you can rename the old table. Create a new table with the old
name, adding the identity column and then the rest of the columns from the
old table.

Then in a single select statement enter the old data back to the new table.

No?

> -----Original Message-----
> From: Richard.Hillegas@... [mailto:Richard.Hillegas@...]
> Sent: Monday, September 21, 2009 8:02 AM
> To: Derby Discussion
> Subject: Re: Add an identity colum
>
> Hi André,
>
> Currently, Derby does not let you add an identity column to a table. It
> is a disabled feature. There is an outstanding JIRA for re-enabling this
> capability: DERBY-3888. I suspect that it is not a lot of work. I am
> sure that the community would give you lots of advice if you decided to
> tackle this issue yourself. Alternatively, if enough people vote for
> this issue, it would percolate to the top of our to-do list.
>
> Thanks,
> -Rick
>
> André Rothe wrote:
> > Hi,
> >
> > How I can add an identity column to an existing table?
> > I have a datatore where I have to alter some tables. It
> > seems not possible to alter an existing column (datatype
> > integer) into an identity column. Can I add such a
> > new column?
> >
> > Tanks
> > Andre
> >



Re: Add an identity colum

by Rick Hillegas-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mike,

Right.

Regards,
-Rick

derby@... wrote:

> But surely you can rename the old table. Create a new table with the old
> name, adding the identity column and then the rest of the columns from the
> old table.
>
> Then in a single select statement enter the old data back to the new table.
>
> No?
>
>  
>> -----Original Message-----
>> From: Richard.Hillegas@... [mailto:Richard.Hillegas@...]
>> Sent: Monday, September 21, 2009 8:02 AM
>> To: Derby Discussion
>> Subject: Re: Add an identity colum
>>
>> Hi André,
>>
>> Currently, Derby does not let you add an identity column to a table. It
>> is a disabled feature. There is an outstanding JIRA for re-enabling this
>> capability: DERBY-3888. I suspect that it is not a lot of work. I am
>> sure that the community would give you lots of advice if you decided to
>> tackle this issue yourself. Alternatively, if enough people vote for
>> this issue, it would percolate to the top of our to-do list.
>>
>> Thanks,
>> -Rick
>>
>> André Rothe wrote:
>>    
>>> Hi,
>>>
>>> How I can add an identity column to an existing table?
>>> I have a datatore where I have to alter some tables. It
>>> seems not possible to alter an existing column (datatype
>>> integer) into an identity column. Can I add such a
>>> new column?
>>>
>>> Tanks
>>> Andre
>>>
>>>      
>
>
>