Solved

Foreign Key

Posted on 2013-02-06
2
445 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

828 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