问题
I am trying to convert a varbinary
to varchar
but it is causing some unwanted characters to show up, as shown below. Could someone please let me know if there is any best way to do it.
I'm trying the following query
SELECT
BLOB_CONTENTS,
CONVERT(VARCHAR(MAX), [BLOB_CONTENTS]),
CONVERT(NVARCHAR(MAX), [BLOB_CONTENTS])
FROM
[hie_temp].[V500].[CE_BLOB]
WHERE
EVENT_ID = '760365'
varbinary
code like this :
0x05028A64F2A9488645100E84053281148A4324080A0412A1209E4C2791CB2208EC7A3F2090C7
I am getting something like this
Šdò©H†E„2ŠC$ ¡ žL'‘Ë"ìz? Ç…ˆÔl8Œ£hÐr-ŒDBy¨O)B„IÑH\CdòA"¤Ò£Ä²)L‚V “…‚‘<¦H©@‰$â!$‡$“é¸ù°A&ˆ Ö˜M–”DŠ‘EåBI6Ý á2ˆœ (•H¥(á„Nœ“H$ÂIR9")•ñ‘’¸€„A)J¶«|xb1ÊÅã‘Ä€ŒLéE£ XÄr
回答1:
RTF is not plain text, you need to write a procedure/function to convert RTF to text, see here.
Alternatively you can do it in your programming language, see this post for an example in C#.
来源:https://stackoverflow.com/questions/51201069/convert-rtf-to-varchar-in-sql-server