Foreign Key not pointing to Primary Key

Posts   
 
    
jg
User
Posts: 25
Joined: 29-Dec-2011
# Posted on: 19-Jun-2013 00:50:18   

LLBLGen Pro 3.1 Final SQL Server 2010

Tables:


ActionPlan:
ActionPlanID int PK
QuestionResultID int FK
...

QuestionResult:
AuditResultGlobalID GUID PK
QuestionResultGlobalID GUID PK
DuplicateID int PK
QuestionResultID int UNIQUE
...

The ActionPlan table has a FK relation to the QuestionResult table using the unique column QuestionResultID. QuestionResultID is not the Primary Key of the QuestionResult table, but it is a unique column.

For some reason the designer isn't picking up the relationship. Is this supported or do all Foreign Keys have to be pointing to the Primary Key field of the referenced table?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 19-Jun-2013 07:38:38   

Hi jg,

Relationships based on Unique Keys/Constraints are not supported. The FK must point to PK fields. If you want, you could create a model-only relationship in your model to emulate the desired relation.

David Elizondo | LLBLGen Support Team