Converting data on insertion

The data you enter into your Sybase IQ database will likely come from diverse sources. Not all of your data will match the Sybase IQ data types exactly. Some of it will need to be converted. Data is converted in two ways: explicitly and implicitly. For example, to insert INT data into a CHAR column you must convert it explicitly.

Implicit conversions can occur:

When an explicit conversion is needed, the way that you specify the conversion depends on whether you are loading from a flat file or inserting selected rows:

For information on implicit and explicit conversions between Sybase IQ data types, see the tables in the section “Data conversions in IQ”.

For information on conversions that occur if you are inserting from proxy tables, see Chapter 4, “Accessing Remote Data,” in the System Administration Guide: Volume 2.

While most Sybase IQ data types are fully compatible with SQL Anywhere and Adaptive Server Enterprise data types of the same name, there are some differences. For details on compatibility, see “Matching Adaptive Server Enterprise data types”.

For compatibility among versions, a few data types have been defined as synonyms of other data types:

You can use a synonym interchangeably with its standard data type. Data is stored internally as the standard data type, where synonyms exist. In error messages, the standard name appears in place of the synonym.

NoteBy default, Sybase IQ assumes that input data is binary (numeric data) and tries to insert it that way. However, this presumes that the input column length in bytes must match the destination column length in bytes. If not, the insert will fail or lead to unexpected results. For example, if you attempt to insert an input column with integer data of 4 bytes into a SMALLINT destination column, Sybase IQ loads only the first 2 bytes of that input column.