SDU Tools: Character to Hexadecimal in T-SQL

SDU Tools: Character to Hexadecimal in T-SQL

I often need to convert values from one data type to another, particularly when working with strings. One function that I’m surprised wasn’t already built in to SQL Server was one that converts a character to its hexadecimal representation.

There is an ASCII function. You can see it here:

This converts a character to its ASCII value (see http://asciitable.com)

We’ve added a function to our free SDU Tools collection for developers and DBAs. It’s called CharToHexadecimal and you can see what it does in the main image above.

You can also see it in action here:

https://youtu.be/aT4viskU7fE

For more information on being an SDU Insider and getting our tools and eBooks, just visit here: http://sdutools.sqldownunder.com.

2018-06-13