• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 361
  • Last Modified:

DTS error cannot insert duplicate key row

I've got a DTS package that inserts info from an excel sheet to a table. When I tried to update the table with a new excel sheet I get an error "cannot insert dublicate key row in object "table" with unique index "i_########" . I'm not very good with SQL so any help will be greatly appreciated.
0
ClintN
Asked:
ClintN
  • 3
  • 2
1 Solution
 
Duane LawrenceCommented:
It means it is trying to insert a duplicate row.

A unique index requires every value in the column to be unique, as in none can be the same.

Duane
0
 
Duane LawrenceCommented:
I typically import data into a temporary table from any file.

Then I clean the data to avoid errors like the one you are getting.

Last I put the data into the core tables of the production database.

Duane
0
 
Duane LawrenceCommented:

After you import it into a temporary table run the query below:

select * from temporaryimporttable where uniquekeycolumnname in ( select uniquekeycolumnname from coretablename)

Duane
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
eclipse2kCommented:
in the SQL Server Enterprise Manager, right click on the table where you are importing the data to, and choose "All Tasks --> Manage Indexes" or something like that, we use a german Version...

There you can see all indexes on that table, there should be the index "i_########" as shown in the error message.

select it, choose "Edit" and uncheck "Unique" or "Unique Values" or something like that (we still use a german Version so dont know the exact wording)
0
 
ClintNAuthor Commented:
Thanks!! I'm stepping through the processes now. I'll get back to you when I finish.
0
 
ClintNAuthor Commented:
There were duplicate entries in the excel file. Thanks a million!!!!!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now