Subject Re: [firebird-support] How to change Primary Key on a table by adding a new field
Author Mark Rotteveel
On Mon, 26 Jan 2015 19:05:33 +0100, "Luigi Siciliano
luigisic@...
[firebird-support]" <firebird-support@yahoogroups.com> wrote:
> Hello,
> I have an application that use a Firebird database and I need to
> change a Primary Key on a table by adding a new field.
>
> I can drop a primary key constraint by "ALTER TABLE MyTable DROP
> CONSTRAINT MyINTEG_000" where "MyINTEG_000" is the constraint on my
> development database file.
>
> I cannot use the instruction above because I don't know in all
> production databases of my customers the name of the Primary Key I want
> update.
>
> How I can solve?

Others have already shown ways to solve to immediate problem. I'd like to
suggest that moving forward you start using explicitly named constraints,
which prevent the need for workarounds like these as then the name of the
constraint is part of your database design itself.

Mark