Returns the unsigned BIGINT equivalent of a hexadecimal string.
HEXTOINT ( hexadecimal-string )
hexadecimal-string The string to be converted to an integer. Input can be in the following forms, with either a lowercase or uppercase “x” in the prefix, or no prefix:
0xhex-string
0Xhex-string
hex-string
The following statements return the value 420:
SELECT HEXTOINT ( '0x1A4' ) FROM iq_dummy
SELECT HEXTOINT ( '0X1A4' ) FROM iq_dummy
SELECT HEXTOINT ( '1A4' ) FROM iq_dummy
For invalid hexadecimal input, Sybase IQ returns an error unless the CONVERSION_ERROR option is OFF. When CONVERSION_ERROR is OFF, invalid hexadecimal input returns NULL.
The database option ASE_FUNCTION_BEHAVIOR specifies that output of Sybase IQ functions, including INTTOHEX and HEXTOINT, is consistent with the output of Adaptive Server Enterprise functions. When the ASE_FUNCTION_BEHAVIOR option is ON:
Sybase IQ HEXTOINT assumes input is a hexadecimal string of 8 characters; if the length is less than 8 characters long, the string is left padded with zeros.
Sybase IQ HEXTOINT accepts a maximum of 16 characters prefixed with 0x (a total of 18 characters); use caution, as a large input value can result in an integer value that overflows the 32-bit signed integer output size.
The data type of the output of the Sybase IQ HEXTOINT function is assumed to be a 32-bit signed integer.
Sybase IQ HEXTOINT accepts a 32-bit hexadecimal integer as a signed representation.
For more than 8 hexadecimal characters, Sybase IQ HEXTOINT considers only relevant characters.
ASE_FUNCTION_BEHAVIOR option in Reference: Statements and Options
CONVERSION_ERROR option [TSQL] in Reference: Statements and Options