on 2012 Jun 01 12:54 PM
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.
Request clarification before answering.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
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?
User | Count |
---|---|
52 | |
6 | |
5 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.