Convert rtf blob to text in MS Sql

I am working with a database. In this database, I have a table with a blob field. This field contains the text rtf. If I do like this:

select convert(nvarchar(max),convert(varbinary(max),blob_column)) from table_with_blob

      

it returns this: せ 〰〰〴 ㄷ ⴶ 㠰 た 㠴 弰 巎 楛 㵤 㠵 㜸 㔰 ⁝َّ.

So my question is how to convert this rtf blob to text using MS Sql 2008?

+3


source to share


1 answer


try with this, it should work

select convert(varchar(max),convert(varbinary(max),blob_column)) from table_with_blob

      



take the link below script -

DECLARE @blob VarBinary(MAX) = CONVERT(VarBinary(MAX), 'test');
-- show the binary representation
SELECT @blob;
-- this doesn't work
SELECT CONVERT(NVarChar(100), @blob);
-- but this does
SELECT CONVERT(VarChar(100), @blob);

      

0


source







All Articles