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.
Author |
Topic |
kappa02
Yak Posting Veteran
65 Posts |
Posted - 2009-03-28 : 02:12:05
|
Why is it when I run this query:ALTER TABLE pub.dbo.Organ ADD CONSTRAINT fkey_Organ_ParentID FOREIGN KEY (ParentID) REFERENCES Pub.dbo.Organ(ID) I receive this statment:Msg 547, Level 16, State 0, Line 2The ALTER TABLE statement conflicted with the FOREIGN KEY SAME TABLE constraint "fkey_Organ_ParentID". The conflict occurred in database "Pub", table "dbo.Organ", column 'ID'.Could it be the vaules in ID & ParentID column |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-28 : 04:49:53
|
it seems like you've some records with values in ParentID which does not correspond to existing ID column values. so either remove them before creating constraint or create constarint WITH NO CHECK option |
 |
|
|
|
|