HEXTOINT function [Data type conversion]

Function

Returns the unsigned bigint equivalent of a hexadecimal string.

Syntax

HEXTOINT ( hexadecimal-string )

Parameters

hexadecimal-string The string to be converted to an integer. Input can be in the following forms, with either a lower or upper case “x” in the prefix or no prefix:

0xhex-string
0Xhex-string
hex-string

Examples

The following statements all return the value 420.

SELECT HEXTOINT ( '0x1A4' ) FROM iq_dummy
SELECT HEXTOINT ( '0X1A4' ) FROM iq_dummy
SELECT HEXTOINT ( '1A4' ) FROM iq_dummy

Usage

For invalid hexadecimal input, Sybase IQ returns an error unless the CONVERSION_ERROR option is set to OFF. When CONVERSION_ERROR is OFF, invalid hexadecimal input returns NULL.

Standards and compatibility

See also

“CONVERSION_ERROR option [TSQL]”

“INTTOHEX function [Data type conversion]”