Actually, this was all I had to use to get all the constraints in my database:
SELECT *
FROM INFORMATION_SCHEMA.TABLE_C
The constraint its complaining about doesn't exist.
Experts,
I have a table called "Agent" with a primary key of AgentID. I want to create a foreign key in my "AgentClient" table using a script. This is how I'm attempting to do it:
ALTER TABLE AgentClient
ADD CONSTRAINT fk_AgentID FOREIGN KEY(AgentID)REFERENCES Agent(AgentID)
GO
However I get this error:
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "fk_AgentID". The conflict occurred in database "CCS_Central", table "dbo.Agent", column 'AgentID'.
There is not constraint by that name on either table. What could be the issue?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You are right "it shouldn't be a problem that there are values in it that are not in AgentClient"
However, as per my knowledge, foreign keys not existing in the primary key table is the reason for this error. Did you also check for NULL/blank values.
This query can help you confirm:
select A.*
from foreigntable A
left outer join primarytable B on A.foreignkey = B.primarykey
where B.primarykey is null
Business Accounts
Answer for Membership
by: jparulPosted on 2009-10-19 at 10:50:01ID: 25607353
Is it possible that fk_AgentID has been created as a constraint for some other table.
Depending on what version of SQL server you are using, you can use the following query to list all constraints in your DB:
select
o1.name as Referencing_Object_name
, c1.name as referencing_column_Name
, o2.name as Referenced_Object_name
, c2.name as Referenced_Column_Name
, s.name as Constraint_name
from sysforeignkeys fk
inner join sysobjects o1 on fk.fkeyid = o1.id
inner join sysobjects o2 on fk.rkeyid = o2.id
inner join syscolumns c1 on c1.id = o1.id and c1.colid = fk.fkey
inner join syscolumns c2 on c2.id = o2.id and c2.colid = fk.rkey
inner join sysobjects s on fk.constid = s.id