I have been trying to convert a vabinary
column to a string in SQL Server 2000. I have tried the recommended methods on this post: varbinary to string on SQL Server but not had any luck yet.
I have it working in SQL Server 2008, just not in SQL Server 2000.
My binary is
0x000000000000000000000000000000000000000000000000000000000000C0FFFF000000000000
When I use select
CONVERT(VARCHAR(1000), @data, 0)
in SQL Server 2008 it works fine, but when I use it in SQL Server 2000 the output I get is
'ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ'
Has anyone come across this issue?
you can do it SQL Server 2005/2000 by using XML.
DECLARE @bin VARBINARY(MAX)
SET @bin = 0x000000000000000000000000000000000000000000000000000000000000C0FFFF000000000000
SELECT @bin AS actualvalue,
CAST('' AS XML).value('xs:hexBinary(sql:variable("@bin"))', 'VARCHAR(MAX)') AS StringValue
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.