SQL Server Performance

Check Constraint Person Relations

Discussion in 'SQL Server 2008 Questions [Archive Only - Closed]' started by luisxvarg, Oct 22, 2009.

  1. luisxvarg New Member

    Hi Guys. I have 2 tables. TPerson(PersonID, ...) and TPersonRelation(PersonRelationID, Person1ID (FK1), Person2ID(FK2), TypeOfRelationID). All fields are integers. The relations are the follow: PersonID --> Person1ID and the same PK Fields PersonID --> Person2ID. How can I implement both relations, if SQL Server don´t allow me to do 2 relations from the same field (PersonID). A trigger could solve this problem, but ... Do you know if exits a more better solution than the trigger? I need to: 1)check Parent Child Relation, cascade deletion. 2)build an index with unique key using Person1ID and Person2ID(FK2). Thanks in advance.. Luis

Share This Page