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
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
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

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…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
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

770 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