TO_HEX

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Converts data to its equivalent hexadecimal representation.

Syntax

to_hex(<data>)

Arguments

Required

  • <data>: The data to encode (int, bigint, or bytea).

Returns

Returns a text value containing the hexadecimal representation of the data.

Considerations

  • Output is lowercase hexadecimal without a '0x' prefix.

Examples

Convert to Hex

Encode an integer to hexadecimal.

SELECT to_hex(2147483647) AS result;

Returns '7fffffff'.

Related Documentation