Subject Re: [firebird-support] Moving primary key to another column
Author Matthias Hanft
Tomasz Tyrakowski wrote:
> That's the procedure I've been using in the past in such cases:

Thank you very much; I'll save this useful "instruction manual" for later :-)

> 1. drop the current primary key (alter table MyTable drop constraint
> OldPrimaryKeyName)

That's what I wanted to do, but I didn't remember "drop constraint".
I just tried "drop index", but it wouldn't let me do this because of
"cannot drop index because index is primary key" (or something similar).
So I thought it might be not possible at all.

> 4. fill the new column using the generator:
> update MyTable set NewKey=(select gen_id(MyGen,1) from RDB$DATABASE)

Brilliant :-) (I already wondered how to fill up an "incrementing"
column automagically.)

Thanks again,