I need to change a Primary Key by adding a new Field in a table.
Unfortunatelly when I created the table I forget to set a name for the primary key
Now I need to drop the primary key to recreate it with more fields but I don't know the name of the primary key, and the statement
ALTER TABLE MYTABLE DROP CONSTRAINT MYINTEG_000
is not usable because I have more database file and the name of Primary keys is different per database file.
I tried to execute statement like this on a TSQLProcessor
SET TERM !!;
EXECUTE BLOCK RETURNS (stmt VARCHAR(1000)) AS
SELECT 'ALTER TABLE MYTABLE DROP CONSTRAINT ' ||
rdb$relation_name = "MYTABLE"
AND rDB$CONSTRAINT_TYPE = 'PRIMARY KEY'
DO begin suspend; execute statement :stmt; end
set term ; !!
seems to work but, even if I don't have error messages, the primary key is not dropped.
How I can solve?