Hi, 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. asked 01 Jun '12, 11:54 Curlew Volker Barth |
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 Glenn Paulley 1) sql anywhere is version 11.0.1.2044 2) PK and FK are both char(20) 3) yes DB validates, tried that before posting error Adding a foreign from within sybase central works. But I get the error from nativeDB. Sql looks correct, but error message doesnt give any clues if I add an index eg create index byperson on mytable (personid) it works, but should have to do that.
(01 Jun '12, 13:36)
Curlew
Replies hidden
No, you should not have to add the index beforehand. I am puzzled why you get the internal error but only when using Native DB. Would it be possible for you to move to a later build of 11.0.1? Build 2044 was the initial release build, and I know that a number of issues in the server have been implemented since the initial release.
(01 Jun '12, 14:09)
Glenn Paulley
My technical director is off until Thursday, and I am sure there wont be an issue with me getting a local copy of 11.x.x.x
(01 Jun '12, 14:31)
Curlew
Possibly you could use request logging of operations ("dbsrv11 -zr ...") to check if the syntax NativeDB is sending is different from that of other SQL clients?
(02 Jun '12, 06:21)
Volker Barth
|