Returns the decimal integer equivalent of a hexadecimal string.
HEXTOINT( hexadecimal-string )
hexadecimal-string The string to be converted to an integer.
The HEXTOINT function accepts string literals or variables consisting only of digits and the uppercase or lowercase letters A-F, with or without a 0x prefix. The following are all valid uses of HEXTOINT:
SELECT HEXTOINT( '0xFFFFFFFF' ); SELECT HEXTOINT( '0x00000100' ); SELECT HEXTOINT( '100' ); SELECT HEXTOINT( '0xffffffff80000001' );
The HEXTOINT function removes the 0x prefix, if present. If the data exceeds 8 digits, it must represent a value that can be represented as a signed 32-bit integer value.
The HEXTOINT function returns the platform-independent SQL INTEGER equivalent of the hexadecimal string. The hexadecimal value represents a negative integer if the 8th digit from the right is one of the digits 8-9 and the uppercase or lowercase letters A-F and the previous leading digits are all uppercase or lowercase letter F. The following is not a valid use of HEXTOINT since the argument represents a positive integer value that cannot be represented as a signed 32-bit integer:
SELECT HEXTOINT( '0x0080000001' );
This function supports NCHAR inputs and/or outputs.
SQL/2003 Vendor extension.
The following statement returns the value 420.
SELECT HEXTOINT( '1A4' );