On 16-2-2016 22:05, watan...@yahoo.com [firebird-support] wrote: > I am using FireBird 2.5.3 > and a Database is updated from 2.2, and the database was updated from 1.5. > > The database have about 150 tables and just one foreign key. > > The Foreign key is from "hachu"Table to "parts"Table > > This is part of definition of the tables. > ISQL display these informations. > > SQL> show table parts; > OPERATIONCODE VARCHAR(100) Nullable > PARTSID INTEGER Not Null > PRODUCTCODE VARCHAR(100) Nullable > CONSTRAINT INTEG_152: > Primary key (PARTSID) > > SQL> show table hachu; > HACHUDATE &n bsp; DATE Nullable > HACHUID INTEGER Not Null > HACHUNO VARCHAR(10) Nullable > HSU INTEGER Nullable > CONSTRAINT FKHACHUTOPARTS: > Foreign key (PARTSID) References PARTS (PARTSID) On Delete Set Null
Interesting that this table doesn't appear to have a column PARTSID, so this constraint shouldn't be able to exist. > I tried to drop the foreign key,but I could not. > SQL> alter table hachu drop constraint fkhachutoparts; > > Statement failed, SQLSTATE = 42000 > unsuccessful metadata update > -cannot delete*-INDEX FKHACHUTOPARTS > -there are 1 dependencies > > I deleted all records of "parts" and "hachu". > I deleted all triggers of "parts" and "hachu". > > But "there are 1 dependencies" Do you have stored procedures referencing this table? > I can't also drop these tables. > > SQL> drop table hachu; > Statement failed, SQLSTATE = 42000 > unsuccessful metadata update > -cannot delete > -INDEX FKHACHUTOPARTS > -there are 1 dependencies > > SQL> drop table parts; > Statement failed, SQLSTATE = 42000 > unsuccessful metadata update > -ERASE RDB$RELATION_CONSTRAINTS failed > -action cancelled by trigger (1) to preserve data integrity > -Cannot delete PRIMARY KEY being used in FOREIGN KEY definition. > > I don't understand why i can't drop the foreign key. > But i want to drop the foreign key. Could you run gifx -v -full -n <database-name> on your database and report the output? If all else fails, you could also consider creating a new database, and pumping over the data. Mark -- Mark Rotteveel