SQL Server 2008 - Converting binary(hex) values to strings
One of the frequently asked questions in the newsgroups
is how do you convert a string representation of a binary value to the
equivalent binary value and the reverse.
The latter is often required to be able to print out the binary
representation.
There have been a few undocumented functions and many home brew
solutions.
In SQL Server 2008 CONVERT can now do it for you. Thanks to Itzik for
pointing this out to me last night.
So you can now do the following
select
convert(varchar(8),
0x023454, 1)
select
convert(binary(3), '0x023454', 1)
Which is great.
-