0
votes

I am getting this error while importing from an Excel file into a table in SQL Server 2008 R2.

I have added a picture.

Copying to [dbo].[MultiPLU] (Error) Messages Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred.
Error code: 0x80004005. An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 10.0"
Hresult: 0x80004005 Description: "The statement has been terminated.".

An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 10.0"
Hresult: 0x80004005
Description: "Cannot insert the value NULL into column 'PLUCode', table 'AR4UWin.dbo.MultiPLU'; column does not allow nulls. INSERT fails.".
(SQL Server Import and Export Wizard)

Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (57)" failed because error code 0xC020907B occurred, and the error row disposition on "input "Destination Input" (57)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)

Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - MultiPLU" (44) failed with error code 0xC0209029 while processing input "Destination Input" (57). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.

(SQL Server Import and Export Wizard)

2

2 Answers

0
votes

The import process requires a value for every row in the 'PLUCode' column, whereas I believe that your excel spreadsheet sometimes has no value in these cells.

0
votes

Right clicking on the PLUCode and setting it to allow nulls will allow you to upload the table. The query below will give you the errored entries for review.

SELECT *
FROM Tablename
WHERE PLUCode IS NULL

If you're dealing with duplicates I would recommend a self join to only give you the unique rows. (You'll need a few 'if' statements to check for rows with null values so you don't delete a whole record and leave you with the broken one.) I would be exceptionally careful with using any predefined remove duplicates function (like in excel) unless you've scrutinized the table to ensure it wont drop the completed rows.

EDIT: To respond the need to save as a flat file you'll want to save as a comma delimited csv file. Its in the usual file formats list unless you're using excel 2010, the itll be under the "Save and Send" option.