Subject Re: Rename Primary Key Foreign Key or Index
Author Alexander V.Nevsky
--- In firebird-support@yahoogroups.com, "Celyo" <iliev@c...> wrote:
> and I have a Primary Key on Field1.
>
> I want to change the Primary Key to be on Field3.
>
> The problem is that I don't know the name of the key!!!

Iliya, this is simple - take a look on structure of the table
RDB$RELATION_CONSTRAINTS and you can easy select name of PK for any
table.

> I know I can see it using either a sql script or any db management
utility
> but my script has to work on databases with PK with different names
and
> should be done ONLY using sql script

So you should make a program which generate script from template for
each database instance examining it's system tables. To avoid such a
problems wise persons don't rely on system generated names of
constrains and give them self-invented names on creation ;) so in all
instances of database they are the same.

Best regards,
Alexander.