Subject problem adding foreign key
Author markd_mms
hi. i'm pretty new to firebird and sql so i'm not sure if i'm making a
stupid mistake...

i have 2 tables, contacts and customers. customers has a pk called ID
and contacts has a field (with no contraints) called CustomerID.

when i execute the following sql i get an error...

alter table CONTACTS
add constraint FK_CONTACTS_CUSTOMERS
foreign key ("CustomerID")
references CUSTOMERS(ID)
on delete CASCADE
on update CASCADE

and the error is...

violation of FOREIGN KEY constraint "PK_CUSTOMERS" on table "CUSTOMERS"

there is another table with a foreign key on Customers.ID. i'm not
sure if this makes a difference.

running v1.5.2.4731

any ideas?

TIA