Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 export to excel problem ?

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2012-08-02 : 17:25:36
Hi friends,
I was trying to export a query to excel file using Import/Export wizard... But when i am trying to do that the following erros props up..


Error 0xc02020c5: Data Flow Task 1: Data conversion failed while converting column "Comments" (98) to column "Comments" (179). 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.".

Does this mean that my database table field 'comments' has more data than the cell of the excel can hold..how to overcome thiss...

in the sql query when i use this cast(comment as varchar(200)) it works fine but data is truncated if i increase the datasize to 300 its failing..

The comment field is ntext type in the table


Thank You

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-02 : 21:33:08
try converting it to nvarchar(300) and see

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2012-08-03 : 15:56:34
Hi visakh ..I tried as you said and this is the error i got:

Truncation may occur due to inserting data from data flow column "Comments" with a length of 300 to database column "Comments" with a length of 255.

Thank you
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-03 : 15:59:23
well.. then you need to increase the length of your destination table. its obvious isnt it?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2012-08-03 : 16:33:03
Thankk You visakh..Can you please tell me how to increase the data size for excel column...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-03 : 16:37:28
quote:
Originally posted by akpaga

Yep but how do you do that for excel coloumn


add a derived column task in between or cast it to nvarchar(300) from source

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2012-08-03 : 16:51:30
Visakh i trie casting it nvarchar(300) but did not work....my destination is an excel file ..thats where the truncation is occurring..

pardon me..but did not understand the derive column concept...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-03 : 17:54:44
quote:
Originally posted by akpaga

Visakh i trie casting it nvarchar(300) but did not work....my destination is an excel file ..thats where the truncation is occurring..

pardon me..but did not understand the derive column concept...


drag and drop a derived column task and add expression to cast it to DT_NTEXT

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -