Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSIS Change Columns Types

I need to know that How to convert nvarchar(255) to varchar(50) in SSIS Type Conversion?

I have tried converting my nvarchar(255) to DT_STR(Unicode) but still it is not working.

like image 968
Faizan Mubasher Avatar asked Dec 16 '22 04:12

Faizan Mubasher


2 Answers

Maybe you want to try something like this in Derived Column SSIS element:

(DT_STR, 50, 1252) SUBSTRING([String],1, 50)

The cast formula is :

(DT_STR, «length», «code_page»)

Because you want to change from unicode to varchar(How to convert nvarchar(255) to varchar(50)), you need to know code page of varchar. Code page is Character encoding.

Usually you need to use code page which is in your SQL Instance, SQL Database, SQL Column.

If you try to write this new string in you table, there is column with property COLLATION, value can be not empty or be empty database default...

I found this page about Code page architecture, there is written how to relate SQL Collation with Code page.

like image 197
Justin Avatar answered Dec 28 '22 10:12

Justin


SSIS Data Type         SSIS Expression                        SQL Server

string                 (DT_STR, «length», «code_page»)        char, varchar
Unicode text stream    (DT_WSTR, «length»)                    nchar, nvarchar, sql_variant, xml
like image 43
M.Ali Avatar answered Dec 28 '22 08:12

M.Ali