CHAPTER 5 Moving Data In and Out of Databases
205
Note When loading from a flat file, use binary data if you have a choice of
using binary or character data. Using binary input can improve performance by
eliminating conversion costs.
Data conversions in IQ
When you use the INSERT statement to insert data directly from a database
rather than from a flat file, you cannot use the load conversion options. If the
data requires explicit conversion, you must use one of the conversion
functions,
CAST or CONVERT, in the SELECT statement where you specify the
data to be inserted. If the data is converted implicitly, Adaptive Server IQ
handles the conversion automatically.
An implicit or explicit conversion is required whenever data types in a
SELECT
statement need to match, but do not. This occurs when you do an
INSERT
SELECT
from one data type to another, but it also occurs whenever you
compare or compute values for differing data types.
The following tables show:
• Which conversions Adaptive Server IQ does implicitly (I)
• Which conversions you must do explicitly (E)
• Which conversions are unsupported (U)
These conversions apply to data within an Adaptive Server IQ database, or
coming from an Adaptive Server Anywhere database, or any other database
connected as a Specialty Data Store.
ASCII CHAR, VARCHAR By default, Adaptive Server IQ assumes same column width
between source and destination columns, which may cause it to
read input file incorrectly. This option lets you specify a different
width for the input column.
DATE DATE Converts ASCII date input of a fixed format to binary.
DATETIME TIMESTAMP (or DATETIME)
or
TIME
Converts ASCII time or date/time input of a fixed format to
binary. The input specification is based on either a 12-hour or 24-
hour clock.
TIME TIME Converts ASCII time input of a fixed format to binary.
NULL all Lets you specify which input data values to convert to NULL on
insert.
Option
Adaptive Server IQ
Datatypes Action