HEX() — Returns the hexadecimal representation of a BIGINT value as a string.
HEX( value )
The HEX() function returns the hexadecimal representation of a BIGINT value as a string. The function will return the shortest valid string representation, truncating any preceding zeros (except in the case of the value zero, which is returned as the string "0").
The following example use the HEX and BITAND functions to return the hexadecimal representations of two BIGINT values and their binary intersection.
$ sqlcmd 1> create table bits (a bigint, b bigint); 2> insert into bits values(555,999); 3> select hex(a) as int1, hex(b) as int2, 4> hex(bitand(a,b)) as intersection from bits; INT1 INT2 INTERSECTION -------- --------- ------------- 22B 3E7 223