problem with relationships
-
Im using microsoft sql server management studio to create my tables. I previously had the relationships working but I have to go back an re-do them and it is throwing me an error: im trying to do primary key 'person id' in person table with foreign key in holiday table 'person id'556 But when I try to save it I am getting the error: - Unable to create relationship 'FK_Holidays_Person'. The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Holidays_Person". The conflict occurred in database "holidays", table "dbo.Person", column 'Id'. any idea as to why it won't allow me to update this?
-
Im using microsoft sql server management studio to create my tables. I previously had the relationships working but I have to go back an re-do them and it is throwing me an error: im trying to do primary key 'person id' in person table with foreign key in holiday table 'person id'556 But when I try to save it I am getting the error: - Unable to create relationship 'FK_Holidays_Person'. The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Holidays_Person". The conflict occurred in database "holidays", table "dbo.Person", column 'Id'. any idea as to why it won't allow me to update this?
You have at least one record in the holidays table with a person ID which doesn't exist in the person table.
SELECT DISTINCT PersonID
FROM Holidays As H
WHERE Not Exists
(
SELECT 1
FROM Person As P
WHERE P.ID = H.PersonID
)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
You have at least one record in the holidays table with a person ID which doesn't exist in the person table.
SELECT DISTINCT PersonID
FROM Holidays As H
WHERE Not Exists
(
SELECT 1
FROM Person As P
WHERE P.ID = H.PersonID
)
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
thank you for the reply, i had to delete all the data in both tables to get it to work