Friday 11 March 2016

SSIS Error: Cannot Convert Between Unicode and Non-Unicode Data Types

Hellooo out there! Welcome back to (the not quite monthly) SQL Something!

This month we are looking at a conversion error I ran into when trying to alter an old SSIS package:

Fig. 1: Error!


Fig. 2: Change isn't easy...

Finally an error that's pretty self explanatory! The error says it can't convert from non-Unicode to Unicode, so obviously we need to find some way to make the two the same type. :-)


We need some way to 'transform' the data, and for that we can use the Data Conversion tool in the SSIS toolbox:

Fig. 3: A change is coming...


1) Drag and drop the Data Conversion tool and then connect your SQL source to it.
Fig. 4: Connect the dots.







2) Right click the Data Conversion tool and select your columns from the input list.
Fig. 5: Choose your columns.

3) Then, importantly, change the data type to the relevant data type that you want it to be.
Fig. 6: Choose your Data Type.



4) Also important, take note of the Output Alias for the column.

5) After you have done that, connect the Data Conversion tool to your destination (in my case, an Excel Destination).
Fig. 7: Still connecting dots.



6) Final important step, right click and edit your destination. Go to the Mappings section and under Inputs, change the name of the input to the name of the Output Alias in Step 4).
Fig. 8: Choose your Alias from Step 4.


And that should be it. :-)

Fig. 9: No more red X.
DISCLAIMER: As stated, I’m not an expert so please, PLEASE feel free to politely correct or comment as you see fit. Your feedback is always welcomed. :-)

No comments:

Post a Comment