
March 21st, 2004, 11:52 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 506
Time spent in forums: 1 Day 10 h 14 m 25 sec
Reputation Power: 5
|
|
|
odd relationship error
I can't figure this one out. I have a feeling there is a simple solution, but I just can't see it. Below is the code for the two tables that are causing the problems.
Here is the error that I get
----
There are no primary or candidate keys in the referenced table 'PlayerPools' that match the referencing column list in the foreign key 'playerPicks_poolID_fk'.
----
on the attached pic part of the ERD is shown for the tables that are involved with the table that I am having trouble inserting.
Thanks for any help that anyone can offer.
Code:
------------------------------------------------------------------------------------------------------
--PlayerPools
------------------------------------------------------------------------------------------------------
--Drop Table PlayerPools
Create Table PlayerPools
(
playerID int not null
,poolID int not null
,Constraint playerPools_PlayerID_PoolID_pk
Primary Key(playerID, poolID)
,Constraint playerPools_playerID_fk
Foreign Key(playerID)
references poolPlayers(playerID)
,Constraint playerPools_poolID_fk
foreign key(poolID)
references pools(poolID)
)
Go
------------------------------------------------------------------------------------------------------
--playerPicks -->can't insert this table
------------------------------------------------------------------------------------------------------
--Drop Table playerPicks
Create Table playerPicks
(
poolID int not null
,poolPlayerID int not null
,hockeyPlayerID int not null
,billID int not null
,CONSTRAINT playerPicks_poolID_pk
PRIMARY KEY (poolID, poolPlayerID, hockeyPlayerID)
,CONSTRAINT playerPicks_poolID_fk
FOREIGN KEY (poolID)
REFERENCES PlayerPools(poolID)
,CONSTRAINT playerPicks_poolPlayerID_fk
FOREIGN KEY (poolPlayerID)
REFERENCES playerPools(playerID)
,CONSTRAINT playerPicks_hockeyPlayerID_fk
FOREIGN KEY (hockeyPlayerID)
REFERENCES hockeyPlayers(playerID)
)
|