Statements in TSQLProcessor seems not work

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

louis
Senior Boarder
Senior Boarder
Posts: 57
Joined: 02.01.2009, 19:41

Statements in TSQLProcessor seems not work

Postby louis » 29.01.2015, 15:18

Hello,
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 :oops:

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
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, even if I don't have error messages, the primary key is not dropped. :cry:

How I can solve?

Thanks

Louis.

Return to “6.6 - stable”

Who is online

Users browsing this forum: No registered users and 1 guest