Cant Import Records into a sql table

Posted on 2014-01-28
Last Modified: 2014-01-28
I am trying to import an excel file into an sql table using ms access, however i am getting the attached error...
Is there a way to find out what exactly is preventing those records from being imported?
(I have tried looking into sql profiler, but didn't see anything under error column)
Question by:bfuchs
  • 4
  • 3
LVL 84
ID: 39816344
I don't see anything on the Word Doc. Just post a screenshot (image) of the error message. Many Experts won't even review your Word document ...
LVL 16

Assisted Solution

by:Surendra Nath
Surendra Nath earned 500 total points
ID: 39816351
looking into the error it says it missed 1311 records due to key violations.

The only thing that I can think of is the primary key on the table... check what is the primary key on the table into which you are loading this data

and check if there are any duplicates with the primary key criteria and remove them from the input file.

Author Comment

ID: 39816385
hi, i think Surendra may be right...
however i am still unable to add those records due to the following

Author Comment

ID: 39816402
Hi Scott,
How do you insert an image?
when i click on the image icon above, it saves as attachment as you see above.
by right click/paste it doesn't work either.
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

LVL 16

Expert Comment

by:Surendra Nath
ID: 39816404
instead of you going back and forth, can you give us your input file here and also the create table script that you used to create the SQL table.

This will help us to pin point the issue and provide you a reliable solution quickly from both the ends.

if that is not feasible due to the red tape of your company (cofidential data ) then what you can do is something like below

1) see 34726 is an id right, check 34726 exists some where else as well, you have to remove it to get it to working.

you have to do it  too all the records, it is easy once you sort that in EXCEL by Id and check for duplicates over there.

Author Comment

ID: 39816416
Hi Serendra,
This latest error seems to be just a setting in the database (identity_insert), how do i set this on?
LVL 16

Accepted Solution

Surendra Nath earned 500 total points
ID: 39816435
you have to use the below command to do it

SET IDENTITY_INSERT <your table name> ON

Open in new window


Author Closing Comment

ID: 39816463
thank you!
(however i am facing now another obstacle to this insert, i guess will post another question)

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now