To all database genius out there,
I hope you can help me with this error I encountered when importing excel file to SQL Server 2005.

This is the error:

Executing (Error)
Messages
Error 0xc020901c: Data Flow Task 1: There was an error with output column "Description" (21) on output "Excel Source Output" (9). The column status returned was: "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 "output column "Description" (21)" failed because truncation occurred, and the truncation row disposition on "output column "Description" (21)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
 (SQL Server Import and Export Wizard)
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "Source - 'Data $'" (1) returned error code 0xC020902A.  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)

Luckily I have a hint what the problem is all about : It is because data type in excel can only accommodate nvarchar 255, and when I import it, it is beyond nvarchar 255, and that it contains special characters like : ',; and chinese characters.
The thing is, I ran out of solutions.
Thank you in advance for those who will help.
Appreciate it. .

How are you importing ?

How are you importing ?

I tight click the database -> tasks -> Import Data

you need to check if data in source is compatible with destination tables structure.

you need to check if data in source is compatible with destination tables structure.

I already did, checked source to destination data types but the problem is, I am importing an excel file with description that contains characters greater than 255 (because excel can only accommodate 255 nvarchar right?) so now I am wondering what next step to take.
I already tried edit mappings and set nvarchar(255) to max but the error still occured.
Thank you foryour help.

I don't understand this.

<<because excel can only accommodate 255 nvarchar right?>>

Increasing the data type size in database side should solve your problem.

Increase the size of your description column, so the data will fit.

I already did that sir, set nvarchar 255 to nvarchar(max), error still occured.

I don't understand this.

<<because excel can only accommodate 255 nvarchar right?>>

Increasing the data type size in database side should solve your problem.

Hi debasisdas,
I mean, since I imported the file, the initial datatype was nvarchar 255, so what I did, I increased it's size, like what you recommended, and set it to nvarchar(MAX) and the error still occured.

increase the size of description field in database...u will able to export excel data to sql

try with some data of length < 255 and check if it works.

The Datasize of the column should be increased before you import from excel. Also ensure that there exist the same number of columns in sql server as with the source file and make sure sql server can accomodate the datatypes of the source file in each respective column.

Should work for you

Just try this. you increase the size of your database field. I encounter this before when i use the SSIS.

Keep it simple, copy data to Access first and then import SQL Server from Access.. It's done for me..

Keep Trying

have you checked the source if it contains any single quote in the data for the column description ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.