Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSIS : Conversion DT_NTEXT to DT_WSTR

Tags:

ssis

Whats the best way to convert DT_NTEXT to DT_WSTR in Derived Colum Transformation.

Regards

like image 792
Sreedhar Avatar asked Jan 07 '10 21:01

Sreedhar


People also ask

What is Dt_ntext in SSIS?

Since the column is a VARCHAR(MAX) data type in SQL Server, SSIS treats this as a DT_TEXT datatype. The DT_TEXT and DT_NTEXT are text data types and there are several limitations related to handling these datatypes in SSIS. For example, none of the string functions would work with these data types.

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.

How can we use derived column in SSIS to convert data type?

You can also use the Derived Column transformation to convert data. This transformation is also pretty simple, you select an input column and then chose whether to replace this column or create a new output column. Then you need to apply an expression in order to come up with the new data for the output column.


2 Answers

The problem here is that the max length of DT_NTEXT is 2^30 ~ 1.073 billion characters, while DT_WSTR max length is 4000 characters.

If all your fields are less than 4000, try Data Conversion Transformation and it may only raise a warning at design time. You would add this before of after the Derived Column Transformation.

like image 170
Damir Sudarevic Avatar answered Sep 29 '22 06:09

Damir Sudarevic


Below are two solution for any types of data conversion in SSIS Package

  1. Use below link

    SQL Server and SSIS Data Types

  2. Mmanually convert that into Unicode string.

    (DT_WSTR,20)Columnname expression.

like image 21
Mitul Panchal Avatar answered Sep 29 '22 06:09

Mitul Panchal