Friday, February 7, 2014

cannot convert between unicode and non-unicode string data types

[OLE DB Source [628]] Error: Column "COLUMN_NAME" cannot convert between unicode and non-unicode string data types


When creating a SSIS package, this kind of error pops up often.

This is caused by different data types used in different applications.


For instance,
  SSIS SQL Oracle
Unicode DT_WSTR nchar, nvarchar nvarchar2
Non-Unicode DT_STR char, varchar varchar2
There are couple of ways to convert data types

1) data conversion

     Very easy to convert. Data types can be changed in Data Conversion Transformation Editor.

2) Oracle connection sometimes requires data conversion within that task. Which means, it errors out even before data conversion

     In this case, cast columns with unistr in a sql command
     
     Select unistr(location_code) as location_code, unistr(last_posted_date) as last_posted_date
     from T_LOCATION

3) Lastly, datatype can be changed within OLE DB Source/destination 

     go to OLE DB source or OLE DB destination advance editor and change data types in "Input and                Output Properties tab"



Translation Maps

References

No comments:

Post a Comment