Subject Foreign Key problem was Re: Error:Object is in use
Author Helen Borrie
At 12:39 AM 23-02-01 +0100, you wrote:
>Hi all !
>
>I have a database used since 4 years with about 70 tables
>with many foreign keys defined in the first create database script.
>
>I always did backup/restore the db after some metadata changes.
>
>I can add new tables but if I try to define a new foreign key
>referencing a primary key field of one of the old tables using a statement
>like this
>
> >>
>ALTER TABLE BEHARTEN ADD FOREIGN KEY (BEH_ID_PLACE) REFERENCES PLACES
>(PL_ID_PLACE);
><<
>
>then I get this eror msg:
>
> >>
>ISC ERROR CODE:335544351
>
>ISC ERROR MESSAGE:
>unsuccessful metadata update
>STORE RDB$REF_CONSTRAINTS failed
>action cancelled by trigger (1) to preserve data integrity
>Name of Referential Constraint not defined in constraints table.

What happens if you use this syntax:

ALTER TABLE BEHARTEN ADD CONSTRAINT FK_BEH_PLACES FOREIGN KEY (BEH_ID_PLACE) REFERENCES PLACES
(PL_ID_PLACE);

Helen


All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________