Subject | Re: [firebird-support] Moving primary key to another column |
---|---|
Author | Matthias Hanft |
Post date | 2012-08-06T16:05:57Z |
Tomasz Tyrakowski wrote:
Thank you very much; I'll save this useful "instruction manual" for later :-)
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.
column automagically.)
Thanks again,
-Matt
>[...]
> 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 constraintThat's what I wanted to do, but I didn't remember "drop constraint".
> OldPrimaryKeyName)
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:Brilliant :-) (I already wondered how to fill up an "incrementing"
> update MyTable set NewKey=(select gen_id(MyGen,1) from RDB$DATABASE)
column automagically.)
Thanks again,
-Matt