I am using sybase 11, Delphi XE with NativeDb components.
I can add a foreign key using sybase central. If I try and execute the same sql via NativeDB I get sql error
Error -300: Run time SQL error -- Person(40000):
the sql line is
alter table tablename add foreign key person (personid) references person
If I add an index onto tablename.personid, the sql will execute no problem.
foreign keys dont require indices, so why is the error generated.
This error is unexpected. We are unaware of any issues with the creation of foreign keys in v11 software.
Keep in mind that in SQL Anywhere all foreign keys are created with indexes to match.
Some follow-on questions:
1) what version/build of SQL Anywhere 11 are you running? 2) are the FK and PK columns for "personID" the identical data type? 3) does your database validate successfully?
answered 01 Jun '12, 13:20