SQL Server Performance

Check Constraint Person Relations Table

Discussion in 'SQL Server 2005 Database Mirroring' started by luisxvarg, Oct 22, 2009.

  1. luisxvarg New Member

    Hi, 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
  2. Luis Martin Moderator

    Kindly don't duplicate posts.

Share This Page