Solved

Foreign Key

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

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.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how the fundamental information of how to create a table.

627 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