Subject Re: Altering Primary Key on Table
Author Adam
--- In, "Tony Masefield"
<polsolsa@y...> wrote:
> I need to change the sort order from ascending to descending on the
> Primary Key for an (empty) table. Have tried (Alter Index/ Drop
> Index) using IBExpert (Pers) and EMS Interbase both of which
> generate SQL errors.
> According to the IB 6 Lang Ref:
> Alter Index
> "Alter Index Fails if Index is defined for a UNIQUE, PRIMARY KEY or
> FOREIGN KEY constraint .. to alter such an index, use DROP INDEX to
> delete the index etc."
> Drop Index
> "Important- You cannot drop system-defined indexes, such as those
> So, how does one do this with an FB (1.5) Table? Must one drop the
> table then re-create from scratch or is there an alternative 'work-
> around'?
> Regards,

Can you not simply drop the primary key constraint then immediately
add another one? It is not the primary and foreign key index you
should play with, but rather think of the system defined indices as
an implementation artifact of a constraint (PK, FK, Unique).

I am not sure if this works because I can not think of a single
benefit to changing the sort order of our PK fields. Please tell me
you are not doing a select (max(ID)+1) sort of query.