//
you're reading...
SQL Server BI, SSIS

Cannot convert between Unicode and non-Unicode string data types

 

Every encounter this ?

“Cannot convert between unicode and non-unicode string data types” in your SSIS package? If you are like me the answer is an astounding  “YES”

And if you are like me you initially spent hours researching a solution. 

Solving the Problem:

There are two basic solutions perform a CAST() or Convert() operation in your source SQL or utilize the Data Type Conversion transform

Using T-Sql Cast or Convert:

SELECT CAST(XYZ as VARCHAR) AS XYZ_un… SELECT CONVERT(VARCHAR, XYZ)

Using the Data Type Conversion Transform:

In SQL Server Data Tools (SSDT), open the Integration Services project that contains the package you want.

In Solution Explorer, double-click the package to open it.

Click the Data Flow tab, and then, from the Toolbox, drag the Data Conversion transformation to the design surface.

Connect the Data Conversion transformation to the data flow by dragging a connector from the source or the previous transformation to the Data Conversion transformation.

Double-click the Data Conversion transformation.

In the Data Conversion Transformation Editor dialog box, in the Available Input Columns table, select the check box next to the columns whose data type you want to convert. Note: You can apply multiple data conversions to an input column.

Optionally, modify the default values in the Output Alias column.

In the Data Type list, select the new data type for the column. The default data type is the data type of the input column.

Optionally, depending on the selected data type, update the values in the Length, the Precision, the Scale, and the Code Page columns.

To configure the error output, click Configure Error Output. For more information, see Configure an Error Output in a Data Flow Component.

Click OK.

To save the updated package, click Save Selected Items on the File menu.

voila you are done!

Bon Appetit

L.Dixon Galler

Advertisements

About ldgaller

Accomplished Data Warehouse Architect, DBA and Software Architect with over 15 years of professional experience and demonstrated success designing and implementing solutions that improve business functionality and productivity. Highly diverse technical background with proven ability to design, develop and implement technology on an enterprise level. I approach all projects with passion, diligence, integrity, and exceptional aptitude.

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: