1
votes

I have a DB OLE Source going to an excel destination. I receive the following error

Error at Data Flow [Excel Destination [88]]: Column "X" cannot convert between unicode and non-unicode string data types.

I have added in a data conversion to change string columns to Unicode. this has not resolved the problem. any guidance would be appreciated

2
You can see on your destination what type your column is under mapping. I would cast your source to the appopiate datatype. Eg. select cast(ColumName as nvarchar(50) as ColumnName from XXX.XXX - If it says error then i would delete your task and create again and write your paste your correct SQL inside your statement (It doesnt handle metadata well, so you need to update it by either deleting task or go to advanced options) this works fine for me. - SqlKindaGuy
Check the solution below. Add an alias of column in data conversion and map it in excel. - Prabhat G
Can you post screenshot of your ssis solution? And screenshot from source and destination setup? - SqlKindaGuy

2 Answers

0
votes

Go to your excel destination component --> mapping --> hover your mouse over column in question, you'll see that it is Unicode Str. Something like this :

img

Hence, you need a data conversion component to add an alias of source column to DT_WSTR Unicode String AND map it in excel destination component.

img2

I replicated your problem and thus providing you solution.

IF this doesn't work, then delete these components and re-add them, as this is will mostly resolve your issue.

0
votes

Try using a derived column instead of data conversion transformation, use the following expression

If destination is unicode

(DT_WSTR,50)[X]

Else

(DR_STR,50,1252)[X]