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 2000 Forums
 SQL Server Development (2000)
 adding a column to the composite key

Author  Topic 

chaithanya
Starting Member

17 Posts

Posted - 2004-10-25 : 04:36:41
i have a table MASTER
ouinstance, consignmentno are primary key columns.
boeno is a column.
this pk column is referenced by a table DETAIL.

now i tried adding boeno to the pk column of MASTER
the DETAIL table doesn't have this boeno
so it's not allowing me to add the boeno column to the composite key.

Is it possible for me to add a column to the composite key without having the column in the reference table?

Chaithanya J

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-10-25 : 06:28:26
No it is not possible.
If you have ouinstance, consignmentno as a unique constraint or unique index then You can.

If you think about it makes sense that a fk can only reference a unique combination of columns.
( PK or UNIQUE CONTRAINT )
If the FK referenced a column combination that is not unique, then it would not be possible to know which row in the MASTER that the row in DETAIL references.

rockmoose
/* Chaos is the nature of things...Order is a lesser state of chaos */
Go to Top of Page
   

- Advertisement -