Converting Binary data to a Hex Character String

Occassionally you might want to convert a binary number into some printable string. This would allow you display some meaning fully numbers hex characters, instead of just some unreadable garbage. This script takes a binary field, of basically any length, and converts it, character by character, to a character string. The character string will contain a string of hex characters that is equivilant to the binary number.

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands
of articles and SQL scripts, a library of free eBooks, a weekly database news roundup,
a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals
that makes it such a success.