Subject Foreign key problem
Author yaedos2000
Hi,

I'm trying to convert an already existing field into a foreign key,
which references the primary key of another table, but get the
following error message:

---------- STATEMENT ----------

alter table TBL_HACS
add constraint FK_TBL_HACS_3
foreign key (VATCODE)
references TBL_C_VAT_RATES(VATCODE)


---------- ERROR MESSAGE ----------

violation of FOREIGN KEY constraint "".
violation of FOREIGN KEY constraint "INTEG_296" on
table "TBL_C_VAT_RATES".

The primary key is being used as a foreign key by other tables
without any table.

The table of the field I'm trying to convert already contains data -
is this what is causing the problem? If so, is there a way to make it
a foreign without deleting the existing data?

Thanks