Convert VarBinary RTF blob to text in MS SQL

I am using SQL Server - 2008.

Column Datatype - VarBinary

      

The RTF file is compressed and stored in this varbinary column.

Now how to access and view data in RTF file using SQL?

it returns this: 㠰た㠴弰巎楛㵤㠵㜸ㄲ㠴.

etc.

An example of tried code here:

http://rextester.com/YOFHK34016

any solution to this. in 2008 the decompression and compression function does not work. how can i get RTF file like text.

+2


source to share


2 answers


This works for me:

select convert(varchar(max),convert(varbinary(max),bv.value)) from blobValue bv

      

Try using varchar instead of using nvarchar. But I said it would return rtf-formatted text, something like:



"{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fnil MS Sans Serif;}{\f1\fswiss\fcharset0 Arial;}"

      

To get real text, you can use .Net dll to convert it. You can add .net dll to your database instead of calling it functions from Sql script. More on this: Call dll function from sql stored procedure using current connection

0


source


This worked for me, thanks to a bunch. I used:



SELECT convert(nvarchar(max),convert(varbinary(max),[FORMULATEXT]))

      

0


source







All Articles