David Charron
Member
For other to reference to. Here is vb.net code that can be used in SSIS to convert/cast a DB2/JDE Blob field which represent a RTF Media Object (F00165) to a SQL Server text field.
Imports System.Windows.Forms
Try
Dim RTFConvert As RichTextBox = New RichTextBox
'encode blob to unicode string then put in rtf of rich text box
RTFConvert.Rtf = System.Text.Encoding.Unicode.GetString(Row.GDTXFT.GetBlobData(0, Integer.Parse(Row.GDTXFT.Length.ToString)))
'put rich text box string (without rtf tag) into text field
Row.sNote.ResetBlobData()
Row.sNote.AddBlobData(System.Text.Encoding.UTF8.GetBytes(RTFConvert.Text))
Catch E As Exception
Row.sNote.ResetBlobData()
End Try
You can change the encoding as needed.
Imports System.Windows.Forms
Try
Dim RTFConvert As RichTextBox = New RichTextBox
'encode blob to unicode string then put in rtf of rich text box
RTFConvert.Rtf = System.Text.Encoding.Unicode.GetString(Row.GDTXFT.GetBlobData(0, Integer.Parse(Row.GDTXFT.Length.ToString)))
'put rich text box string (without rtf tag) into text field
Row.sNote.ResetBlobData()
Row.sNote.AddBlobData(System.Text.Encoding.UTF8.GetBytes(RTFConvert.Text))
Catch E As Exception
Row.sNote.ResetBlobData()
End Try
You can change the encoding as needed.