Ask Your Question
0

Trouble creating a relationship between tables. Error message SQL Status: S0011 Error code: -60

asked 2019-01-09 17:06:21 +0200

L BB gravatar image

I am trying to create a relationship between two tables. Both have data. The relationship is to be one to many from the Key field in the first table to a non-key field in the second table. When attempting to make the relationship, I am getting the error message: "Constraint already exists in statement [ALTER TABLE "People" ADD FOREIGN KEY ("AddressID") REFERENCES "Property" ("AddressID")]"

The data in the two tables for the AddressID appears to be the same. The only difference I can find is that the AddressID field in the second table is not set to require an entry. When I try to change it to required entry, I get a different error message and can't change it.

Any ideas on the problem with the tables relationship?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2019-01-09 18:27:22 +0200

L BB gravatar image

I recreated the second table to make the AddressID field to require an entry and I can now create the relationship. So that may have been the problem. However, I would love to hear if anyone knows if that was the only fix.

edit flag offensive delete link more
0

answered 2019-01-09 20:14:03 +0200

Ratslinger gravatar image

Hello,

The only way to really resolve the situation is to use SQL to find out what already existed on the field(s) in question. The error message states something was there already.

What SQL to use is dependent upon the database being used (not mentioned in the question). Further information on this is in the documentation for the database being used. This is easily found with a quick internet search. Since Base can utilize many different types of databases, this is not part of the Base documentation.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-01-09 17:06:21 +0200

Seen: 41 times

Last updated: Jan 09