Solved

Foreign Key

Posted on 2013-02-06
2
443 Views
Last Modified: 2013-02-06
ALTER TABLE Curve_W_Sign
ADD CONSTRAINT fk_Curve
FOREIGN KEY (Support_ID)
REFERENCES Asupport_Sign(Support_ID)

Msg 547, Level 16, State 0, Line 1
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "fk_Curve". The conflict occurred in database "CNTY_GIS", table "dbo.Asupport_Sign", column 'Support_ID'.


Within my "Child" table i do have duplicates of the ID that are in the Support_Sign table which i thought should be ok? is it? The Parent Table can have multiple ID's in the "Child" Tables right?
0
Comment
Question by:PtboGiser
2 Comments
 
LVL 25

Accepted Solution

by:
jogos earned 500 total points
ID: 38860502
More foreign keys in your curve_w_sign can point to same primary key in asupport_sign.

But problem will be that there are key's that don't exists.
select * from curve_w_sign  as c
where not exists (select 1 from asupport_sign a where a.support_id = c.support_i)

Open in new window

0
 

Author Closing Comment

by:PtboGiser
ID: 38861192
Thanks for your help!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now