Comparisons between numeric data types

SQL Anywhere uses the following rules when comparing numeric data types. The rules are examined in the order listed, and the first rule that applies is used:

  1. If one argument is TINYINT and the other is INTEGER, convert both to INTEGER and compare.
  2. If one argument is TINYINT and the other is SMALLINT, convert both to SMALLINT and compare.
  3. If one argument is UNSIGNED SMALLINT and the other is INTEGER, convert both to INTEGER and compare.
  4. If the data types of the arguments have a common super type, convert to the common super type and compare. The super types are the final data type in each of the following lists:
    • BIT » TINYINT » UNSIGNED SMALLINT » UNSIGNED INTEGER » UNSIGNED BIGINT » NUMERIC
    • SMALLINT » INTEGER » BIGINT » NUMERIC
    • REAL » DOUBLE
    • CHAR » LONG VARCHAR
    • BINARY » LONG BINARY

    For example, if the two arguments are of types BIT and TINYINT, they are converted to NUMERIC.