• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • 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
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.

 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

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