DTS Error...COLUMN FOREIGN KEY constraint...Excel to SQL or SQL to SQL

Posted on 2005-03-28
Medium Priority
Last Modified: 2008-03-10
I am trying to copy 2 fields from a table into a different table in the same database.  Using the DTS I match up the columns and proceed with the copy.  It throws an error  (INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'XXXXX'...."  The error in on the on the very last line in the column.  I have tried importing from Excel as well...Same conflict... How do I force it to copy this information over???

Robert Zordel
Dataentity, LLC
Question by:dataentity
  • 2
LVL 34

Expert Comment

by:Brian Crowe
ID: 13648136
determine which foreign key you are conflicting with and either disable it or conform.
LVL 75

Accepted Solution

Anthony Perkins earned 1400 total points
ID: 13648142
>>How do I force it to copy this information over???<<
Without making any changes you cannot.  Simply put it is violating a relationship between the two tables.  

I suspect the problem is an EOF character at the end. So as a workaround consider opening it with a text editor and confirming that is the case, prior to removing that row.  If you do not like the idea of deleting the row, consider using a VIEW to filter it out.

Author Comment

ID: 13652792
How would I create a VIEW to filter it out?   I think your right on the EOF character, but it might just be easier to delete the row and then manually add it back in.  I am only using 2 columns after all.  What do you think?
LVL 75

Expert Comment

by:Anthony Perkins
ID: 13652927
>>How would I create a VIEW to filter it out?  <<
Post the structure of the table.

>> but it might just be easier to delete the row <<
I agree.


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
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 SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

621 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