TO_HEX

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Converts data to its equivalent hexadecimal representation.

Syntax 

1to_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.

1SELECT to_hex(2147483647) AS result;

Returns '7fffffff'.

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!