Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com

Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com
I had a task yo import data from Excel spreadsheet to SQL Server table.
Last time I tried to use SQL Server Management Studio import option, but it gave me some not clear errors, that I didn't understand.
So I've created SSIS project in VS and was able to narrow down the errors and import  the data.
 
This time for similar spreadsheet I had some errors again. The output contained the warnings about length of the string column, that usually can be ignored, e.g.:
Warning: 0x802092A7 at First Task, Destination - CompanyCountries [20]: Truncation may occur due to inserting data from data flow column "CountryCode" with a length of 255 to database column "CountryCode" with a length of 50.
Ideally they should be shown only when the data string actually truncated.
 
After a lot of information traces the errors similar the following were shown:
 

Error: 0xC0202009 at First Task, Destination 2 - SIPPs [144]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.

An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Unspecified error".

Error: 0xC020901C at First Task, Destination 2 - SIPPs [144]: There was an error with input column "HireCompanyCode" (174) on input "Destination Input" (157). The column status returned was: "The value violated the integrity constraints for the column.".

Error: 0xC0209029 at First Task, Destination 2 - SIPPs [144]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "input "Destination Input" (157)" failed because error code 0xC020907D occurred, and the error row disposition on "input "Destination Input" (157)" 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.

Error: 0xC0047022 at First Task, DTS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination 2 - SIPPs" (144) failed with error code 0xC0209029. 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.

Error: 0xC0047021 at First Task, DTS.Pipeline: SSIS Error Code DTS_E_THREADFAILED. Thread "WorkThread0" has exited with error code 0xC0209029. There may be error messages posted before this with more information on why the thread has exited.

Task failed: First Task

SSIS package "ExcelImport.dtsx" finished: Failure.

 
I wasn't able to find what [144] and (157) mean- I thought, that it's lines in  the data input, but I didn't find issues with particular rows.
I had to remove all constraints and "not null" restrictions from the target SQL table before the import was successful.
When I analyzed imorted data, I understood, that Excel had empty rows at the end, that were tried to import as null values.
I've deleted null records and used sp_generate_inserts to create SQL script for production.
 
 
By the way, when I included SSIS solution to TFS source control, the file Integration Services Project1.database was included. Previously I renamed the solution and project to the meaningful name, but this file wasn't renamed. Do I need it at all? Can I rename it?

Posted on Friday, January 9, 2009 11:55 AM SQL Server | Back to top


Comments on this post: SSIS import from Excel to SQL table doesn't like empty lines

# re: SSIS Doubt
Requesting Gravatar...
Truncation may occur due to inserting data from data flow column column36 with a length of 255 to database column "teinte_croisillon2" with a length of 20.

While executing the package i get this type of error.even i have altered the table's datatype.

Thanks in Advance.
samy
Left by samy on Aug 04, 2009 5:16 AM

# re: SSIS import from Excel to SQL table doesn't like empty lines
Requesting Gravatar...
I had all these problem and they all went away when I (created and) selected the Named Ranges instead of the Excel worksheets when importing tables from Excel to SQL Express. I could then set the Primary Key and make some columns non null etc... It took me a good part of the day but the clue was when you wrote that some empty rows were imported as well.
Thank you!
Steph
Left by Stephane Guerin on Feb 16, 2010 6:40 PM

# re: SSIS import from Excel to SQL table doesn't like empty lines
Requesting Gravatar...
Faced the same issue while importing excel. Problem was that excel sheet contained some rows with blank data at the end. Physically selected and deleted these rows in excel and it worked fine in the next run.
Left by Kiran on Sep 20, 2010 6:26 AM

# re: SSIS import from Excel to SQL table doesn't like empty lines
Requesting Gravatar...
Hi guys,
I found the solution.
When you import excel file put first the conditional split. You can place there condition that all empty rows doesn't have to be handled.
The conditional split transformation will handle only not empty rows then.
The condition can looks like "ISNULL(FieldName) || LEN(FieldName) == 0" and it means if the FieldName is null or the length of the FieldName is equal to 0.
Enjoy. ;-)
Left by Martin Kafka (avast) on Nov 09, 2010 5:38 PM

# re: SSIS import from Excel to SQL table doesn't like empty lines
Requesting Gravatar...
@Martin
That you very very much! I was not familiar with this control....just saved my SSIS impl. simply great tip!
Left by Mark on Feb 09, 2011 10:23 AM

# re: SSIS import from Excel to SQL table doesn't like empty lines
Requesting Gravatar...
My DTS Wizard was working fine and was able to import the same excel files without any problems. I upgraded my sql server 2005 to licensed version. Now I am getting the error about Truncation. Tried changing the field length but still no resolutions to the problem. Now I am getting error:
TITLE: SQL Server Import and Export Wizard
Error 0xc00470fe: Data Flow Task: The product level is insufficient for component "Source - 'MANUAL ADJ$'" (1).
Left by DTSCranking on Apr 07, 2012 5:55 AM

# re: SSIS import from Excel to SQL table doesn't like empty lines
Requesting Gravatar...
One more thing you can try for truncation error is:

Double click on the Excel Source component. Click on the Error Ouput on the left side and then choose "Ignore Failure" for the truncation column.
Left by Zafar on Aug 23, 2012 4:05 AM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net