Solved

Foreign Key

Posted on 2013-02-06
2
458 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

739 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