问题
I am using SQL server - 2008.
Column Datatype - VarBinary
RTF File is compressed and saved to this varbinary column.
Now how to access and view data in RTF file using SQL ?
it's returns this: 㠰た㠴弰巎楛㵤㠵㜸ㄲ㠴.
etc.
Sample Tried Code here:
http://rextester.com/YOFHK34016
any solution to this. in 2008 Decompress and compress function not work. how i can get RTF file as it is to text.
回答1:
That's works for me:
select convert(varchar(max),convert(varbinary(max),bv.value)) from blobValue bv
Instead using nvarchar try to use varchar. But I shuld say that this will return rtf formated text, something like:
"{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fnil MS Sans Serif;}{\f1\fswiss\fcharset0 Arial;}"
To get actual text from it you can use .Net dll to convert it. You can add .net dll to your database and than call it's functions from Sql script. More detailed about it: Call dll function from sql stored procedure using the current connection
回答2:
It worked for me, thanks a bunch. I used:
SELECT convert(nvarchar(max),convert(varbinary(max),[FORMULATEXT]))
来源:https://stackoverflow.com/questions/45567600/convert-varbinary-rtf-blob-to-text-in-ms-sql