SQL Server 2014 Import Failing

I am trying to import about 10,000 records from an Excel spreadsheet into a ready made empty SQL table using SQL Server Import and Export Wizard 2014.

The data has a few odd characters such as the trademark sign or letters with accents etc. I kept importing it then when it failed I would see how many records had worked and go into Excel and around the same place I was able to find the character causing the problem and do a search replace throughout the spreadsheet to replace it it with the correct HTML for that character.

However I have now got stuck as the import keeps failing and I cannot see any odd characters near the point of failure.

My main question is: Is there any way to find out EXACTLY which line is causing the problem? It seems sometimes the import does not stop at the exact point of failure but several records before it?

The table I am importing to has fields which are definitely long enough for the data.

This is the error I am getting:

Messages
Error 0xc02020c5: Data Flow Task 1: Data conversion failed while converting column "ProductDescription" (224) to column "ProductDescription" (367). The conversion returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
(SQL Server Import and Export Wizard)

Error 0xc020902a: Data Flow Task 1: The "Data Conversion 0 - 1.Outputs[Data Conversion Output].Columns[ProductDescription]" failed because truncation occurred, and the truncation row disposition on "Data Conversion 0 - 1.Outputs[Data Conversion Output].Columns[ProductDescription]" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)

Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Data Conversion 0 - 1" (359) failed with error code 0xC020902A while processing input "Data Conversion Input" (360). 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)

Error 0xc02020c4: Data Flow Task 1: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.
(SQL Server Import and Export Wizard)

Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - Sheet1$ returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)

Thanks in advance!

I would suggest you to use SSIS,which is very good at handling the data conversions.

1 Like

Thanks for the reply.

Sorry to sound thick but where do I find that? I have the free SQL Server Management Studio 2014 package

The one highlighted in yellow,you need to at least have developer edition to use the Business intelligence tools.

I am stuck then as I only have the free version

I believe the Developer Edition is now free. Used to only be about $40 I think?? That lets you do anything that the Enterprise Edition can do. The licence prohibits use on commercial production systems, but you could do the DEV part ... I don't know if you can then deploy an SSIS package to the freebie-version of SSMS?? (or if your project is a one-off DEV project, or falls outside the "commercial" definition in the licence)

My usual route is to create a staging table with lots of very wide VARCHAR columns - e.g. VARCHAR(8000) - matching the number of columns in then import data, and an additional column for ErrorMessages. I import the "raw" data into the staging table, and then perform various validity checks on the data (Is column 4 numeric and between 1 and 999?) and for anything that does not conform I append a suitable explanation to the ErrorMessages column. Then I import from the Staging Table to the actual table (either ignoring rows with ErrorMessages, or not importing anything until there are no error messages on any row - i.e. the User has cleaned up the data). The ErrorMessages can be displayed tot he user to enable them to sort the data out.

Here is the link for the free download
https://myprodscussu1.app.vssubscriptions.visualstudio.com/Downloads?pid=1682