Returns the hexadecimal equivalent of a decimal integer.
INTTOHEX ( integer-expression )
integer-expression The integer to be converted to hexadecimal.
The following statement returns the value 3B9ACA00:
SELECT INTTOHEX( 1000000000 ) FROM iq_dummy
The following statement returns the value 00000002540BE400:
SELECT INTTOHEX ( 10000000000) FROM iq_dummy
If data conversion of input to INTTOHEX conversion fails, Sybase IQ returns an error, unless the CONVERSION_ERROR option is OFF. In that case, the result is NULL.
ASE_FUNCTION_BEHAVIOR option The database option ASE_FUNCTION_BEHAVIOR specifies that output of IQ functions, including INTTOHEX and HEXTOINT, be consistent with the output of Adaptive Server Enterprise functions. The default value of ASE_FUNCTION_BEHAVIOR is OFF.
When the ASE_FUNCTION_BEHAVIOR option is disabled (the value is OFF):
The output of INTTOHEX is compatible with SQL Anywhere.
Depending on the input, the output of INTTOHEX can be 8 digits or 16 digits and is left padded with zeros; the return data type is VARCHAR.
The output of INTTOHEX does not have a ‘0x’ or ‘0X’ prefix.
The input to INTTOHEX can be up to a 64-bit integer.
When the ASE_FUNCTION_BEHAVIOR option is enabled (the value is ON):
The output of INTTOHEX is compatible with ASE.
The output of INTTOHEX is always 8 digits and is left-padded with zeros; the return data type is VARCHAR.
The output of INTTOHEX does not have a ‘0x’ or ‘0X’ prefix.
Sybase IQ INTTOHEX assumes input is a 32-bit signed integer; a larger value can overflow and a conversion error can result. For example, the statement:
SELECT INTTOHEX( 1000000000 ) FROM iq_dummy
returns the value 3B9ACA00
.
But the statement:
SELECT INTTOHEX( 10000000000 ) FROM iq_dummy
results in a conversion error.
CONVERSION_ERROR option [TSQL] in Reference: Statements and Options
ASE_FUNCTION_BEHAVIOR option in Reference: Statements and Options