Select trim(RC.RDB$INDEX_NAME)
from RDB$RELATION_CONSTRAINTS RC
where (RC.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY') and
(RC.RDB$RELATION_NAME = :TABELA)
into :PKTEMP

Using that select you can fiind the name of the column who has the primary
key. 
Inspired from Carlos Cantu external log procedure. Maybe you can be inspired
to.

-----Original Message-----
From: firebird-support@yahoogroups.com
<mailto:firebird-support@yahoogroups.com> 
[mailto:firebird-support@yahoogroups.com] 
Sent: Monday, January 26, 2015 8:06 PM
To: firebird-support@yahoogroups.com
<mailto:firebird-support@yahoogroups.com> 
Subject: [firebird-support] How to change Primary Key on a table by adding a
new field

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?

Thanks.
-- 

Luigi Siciliano
--------------------------

------------------------------------

------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu. Try FAQ and other links from the left-side menu
there.

Also search the knowledgebases at
http://www.ibphoenix.com/resources/documents/ 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------

Yahoo Groups Links



  • [firebird-... Luigi Siciliano luigi...@tiscalinet.it [firebird-support]
    • RE: [... 'Bogdan Mihalache' bogdan.mihala...@soter.ro [firebird-support]
      • R... 'Bogdan Mihalache' bogdan.mihala...@soter.ro [firebird-support]
        • ... Luigi Siciliano luigi...@tiscalinet.it [firebird-support]
    • Re: [... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]

Reply via email to