Unicode to Codepage in SSIS package:
In SSIS package, for converting from Unicode to Codepage, follow the following steps:
1. Source table (Contains Unicode data)
2. Script component
3. Data Conversion
2. Destination table (Contains Codepage data)
For converting Unicode to Codepage
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim codePageNumber As Integer = System.Text.Encoding.GetEncoding(Row.charset).CodePage
Dim unicodeBytes As Byte() = Row.unicodecolumn.GetBlobData(0, CInt(Row.unicodecolumn.Length))
Dim codepagebytes As Byte() = System.Text.Encoding.Convert(System.Text.Encoding.Unicode, System.Text.Encoding.GetEncoding(codePageNumber), unicodeBytes)
Row.codepagecolumn.AddBlobData(codepagebytes)
End Sub
Note:
UnicodeColumn - Unicode data which will be in DT_NTEXT
CodepageColumn - Codepage data which need to be in DT_TEXT
Declare CodePageColumn as output parameter and set the datatype as DT_TEXT.
Then map it to Destination table where codepage need to be stored.
If you want to converrt it again to DT_NTEXT, you can do this using DATA Conversion.
Hope this will help you.