We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Unable to load the csv file in the package

Medium Priority
Last Modified: 2012-05-11
Hi experts, I am getting the following error when trying to insert data into the table via ssis package:
Pls help how to resolve this.

[Data Load into source [102]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E2F.
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E2F  Description: "The statement has been terminated.".
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E2F  Description: "Violation of PRIMARY KEY constraint 'PK_source_test'. Cannot insert duplicate key in object 'dbo.source_test'.".
Watch Question

it would appear that the table you are inserting your data into has a primary key that the csv isn't adhering to.
first i would try to insert the csv into a table with no constraints on it.

if that works then i would look at the table you are trying to import the information into.
have you already tried to import the table once?

and finally(if you can''t find the problem with the PK) i would add an identity column to the table to be the primary key, that way the records are always unique
Top Expert 2011

hi sqlcurious,
- "record is available" - means the record you are inserting already exist in that destinatin table.
- "Violation of PRIMARY KEY constraint 'PK_source_test" - same as above error, the Primary Key data you are inserting already exist in that table.

- i would suggest you to create a dummy/temp table similar to the production table that you are trying to load to. make sure that dummy/temp table is empty and doesn't have any constraint created. load using SSIS package to that dummy/temp table.
- once it's loaded, check if there is duplicate data in that dummy/temp table itself
- next compare Primary Key data between the existing table and the dummy/table to find duplicate record. you might want to delete the duplicate in the dummy/temp table first to clean-up the records to make sure no duplicate record exist.
- then do insert from dummy/temp table into the existing table.

Just to add...you can also turn ignore condition ON to disable preventing the job from terminating
Solution Architect at TCS (SAFe®Agilist, TOGAF® Foundation, PSM I®, MCP, MCSD)
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview


Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.