Reputation: 245
I need to change the binary output to varchar(string), but it must same as to be the binary output. But while converting the binary(hex) value to varchar, empty set will be returned. Kindly help me.
E.x
If this is my binary value 0x24000000008B0100000000
.
I need the same 0x24000000008B0100000000
output after converting it into string.
Upvotes: 3
Views: 16988
Reputation: 354
this also works for me :
SELECT CONVERT(VARCHAR(1000), varbinary_val, 1);
just change your value with varbinary_val
Upvotes: 3
Reputation: 2809
should work like:
DECLARE @a BINARY(20) = 0x24000000008B0100000000
SELECT CONVERT(varchar(max),@a,1), @a
Upvotes: 0
Reputation: 987
declare @val binary(20)
set @val=0x24000000008B0100000000
select @val, CONVERT(varchar(max),@val,1)
Upvotes: 10