Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coverting unicode string to non unicode string in SSIS 2012

I have a requirement of inserting a hardcoded string value into table which is having column as varchar(100).

I have few more fields to insert that is coming from flat file and for inserting harcoded string I have used "Derived Column" component in SSIS.When I am mapping my derived column to varchar column in table ,I am getting an error "Cannot convert unicode to non-unicode string ". I am wondering if there is any way I can convert this column to non-unicode string.

Please help and suggestions are welcome.

like image 732
Ishan Trikha Avatar asked Mar 28 '14 03:03

Ishan Trikha


People also ask

What is the difference between Unicode and non Unicode in SSIS?

The only difference between the Unicode and the non-Unicode versions is whether OAWCHAR or char data type is used for character data. The length arguments always indicate the number of characters, not the number of bytes.

How do we convert data type in SSIS?

The Data Conversion transformation converts the data in an input column to a different data type and then copies it to a new output column. For example, a package can extract data from multiple sources, and then use this transformation to convert columns to the data type required by the destination data store.

Is Excel Unicode or non Unicode?

By default Excel data is treated as Unicode and also by default when you create new tables SQL Server will make your character type columns Unicode as well (nchar, nvarchar,etc...)


1 Answers

you can achieve this without explicit conversion by right clicking on the derived column component and selecting 'show advance editor'. Then 'Input and Output Properties' > 'Derived Column Output' > 'Output Column' > your column; then you can set the data type property to DT_STR.

like image 126
Jayvee Avatar answered Nov 03 '22 00:11

Jayvee