Hello Bogdan,
thanks for your suggestion.
By ZeosLib TSQLProcessor, I try this:
----------------------
SET TERM !!;
EXECUTE BLOCK RETURNS (stmt VARCHAR(1000)) AS
BEGIN
FOR
SELECT 'ALTER TABLE MYTABLE DROP CONSTRAINT ' ||
rdb$constraint_name
from
rdb$relation_constraints
where
rdb$relation_name = "MYTABLE"
AND rDB$CONSTRAINT_TYPE = 'PRIMARY KEY'
into :stmt
DO begin suspend; execute statement :stmt; end
END!!
set term ; !!
---------------------------
seems to work but not commit the statement. The primary Key is yet
present :(
Where I have a mistake?
Thanks
Il 26/01/2015 19.49, 'Bogdan Mihalache' bogdan.mihala...@soter.ro
[firebird-support] ha scritto:
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
<mailto:firebird-support@ya%0Ahoogroups.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
--------------------------
------------------------------------
------------------------------------
++++++&# 43;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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
--
Luigi Siciliano
--------------------------