Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Check Constraint Person Relations

Author  Topic 

luisxvarg
Starting Member

1 Post

Posted - 2009-10-22 : 03:10:13
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
   

- Advertisement -