Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


DTS error cannot insert duplicate key row

Posted on 2004-11-02
Medium Priority
Last Modified: 2008-02-01
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.
Question by:ClintN
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
  • 3
  • 2

Expert Comment

by:Duane Lawrence
ID: 12473452
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.


Accepted Solution

Duane Lawrence earned 2000 total points
ID: 12473471
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.


Expert Comment

by:Duane Lawrence
ID: 12473494

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

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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.


Expert Comment

ID: 12474456
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)

Author Comment

ID: 12475357
Thanks!! I'm stepping through the processes now. I'll get back to you when I finish.

Author Comment

ID: 12486015
There were duplicate entries in the excel file. Thanks a million!!!!!!!

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

618 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