Skip to main content
Version: current [25.0.x]

UNHEX

Categories: Conversion, String, Binary

UNHEX

Converts the hexadecimal number into the bytes represented by a number.

Syntax

UNHEX(expression varchar) → varbinary

  • expression: A string containing only hexadecimal digits.

Examples

UNHEX example
SELECT UNHEX('4472656D696F')
-- RHJlbWlv

Usage Notes

The returned value is a binary string. If the expression contains non-hex characters the result is NULL.