cancel
Showing results for 
Search instead for 
Did you mean: 

Spurious SQL Run time error

Former Member
3,468

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member

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?

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

VolkerBarth
Contributor
0 Kudos

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?