SQL Server:将图像数据转换为字符串

时间:2017-06-22 15:07:44

标签: sql-server

我尝试从旧应用程序读取数据,其中一个字段作为图像数据类型存储在MS SQL Server中。我感觉它是作为图像存储的XML数据。任何想法如何转换它?

以下是一个例子:

0xBB010000313035340000000000000000000000000000000000000000000000000000000000010000000000000000A084400000000000F09E40384100000000000000000000000000000000000000000000000000000000000000000000000000000000000054455841532053454354494F4E00000033320000000000000000000000000031380000000054265020525220434F000000000000000000000000000000000000000000000000334E00000000000000000000000000005345433A313820424C4B3A3332205352563A54265020525220434F204142533A31303534202F2031393830204653203636302046452054455841532053454354494F4E202F205343414C45445F464F4F54202F20524547554C41544F5259000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

1 个答案:

答案 0 :(得分:0)

实际上,您的字符串是存储为hex数据类型的平坦数据库记录。如果你谷歌'将十六进制转换为字符串'并粘贴到您的样本中,您将看到记录。

您需要做的是将字符串转换为byte[]数组,然后您可以将byte[]数组转换为字符串。

有关如何执行此操作的提示,请参阅以下问题: Converting from hex to string

干杯!