Navigation:  Advantage SQL > SQL Functionality >

Functions to Convert Hexadecimal Values

Advantage SQL Engine

Previous pageReturn to chapter overviewNext page

The function CHAR2HEX can be used to convert character data containing hexadecimal characters to a binary value.  Two hexadecimal characters will be converted to one byte.  If the string contains an odd number of hexadecimal characters the value will be zero padded.  Spaces can be included in the string to improve readability, but will be ignored.  CHAR2HEX( ’00 00 00 2A’ ) would be converted to a 4 byte value containing the decimal value 42.  CHAR2HEX( ’00 00 00 2’ ) would be converted to a 4 byte value containing the integer value 32.

 

The function HEX2CHAR converts a binary value to character value.  Each byte of the binary value is represented as two hexadecimal characters.   HEX2CHAR called with the binary value 0x002A would return the character value ’00 00 00 2A’.

 

 

See Also

String Functions

Supported Scalar Functions

Expression Engine

SQL Literals