Sybase Adaptive Server IQ 12.4.2 Administration And Performance Manual page 229

Table of Contents

Advertisement

Truncation of data for
VARCHAR and CHAR
columns
shipinfo.t
column
format
l_shipmode
CHAR
l_quantity
ASCII
CHAPTER 5
If the width of the input column is greater than the width of the destination
column, Adaptive Server IQ truncates the data upon insertion. If the width of
the input data is less than the width of the destination column, for
data types Adaptive Server IQ pads the data with spaces in the table
VARCHAR
upon insertion.
Variable width inserts to a
trimmed, while fixed width inserts to a
example, assume that you are inserting into column
. The following would constitute a fixed-width insert, where the value
vartable
would not be trimmed because you explicitly say to include the two blanks
(indicated by __ here):
INSERT INTO vartable VALUES ('box__')
If instead you inserted the same value from a flat file using delimited input, it
would be a variable-width insert, and the trailing blanks would be trimmed.
The following table illustrates how the
Adaptive Server IQ data types. The example inserts the data from the flat
ASCII file shipinfo.t into the Adaptive Server IQ table
the content and format of the input data and the table.
Table 5-6: Input file conversion example
width
15
8
For the
column, you insert ASCII data into an ASCII column (that
l_shipmode
has a
data type). Notice the width of the two columns is different.
VARCHAR
In order for the insert on this column and the subsequent
be correct, you specify the width of the
amount of input data is read at the correct position.
For the
column, you are inserting ASCII data into a binary column
l_quantity
(
data type). In order for the insert on this column to be correct, you must
INT
convert the input data into binary and indicate the width of the input column.
The command for this is shown in the following UNIX example.
LOAD TABLE lineitem(
l_shipmode ASCII(15),
l_quantity ASCII(8),
FILLER(1))
FROM '/d1/MILL1/shipinfo.t'
PREVIEW ON
Moving Data In and Out of Databases
column will not have trailing blanks
VARCHAR
column will be trimmed. For
VARCHAR
conversion option works with the
ASCII
lineitem
column
datatype
l_shipmode
VARCHAR
l_quantity
INT
l_shipmode
or
CHAR
in a table called
varcolumn
and summarizes
lineitem
width
30
4
column to
l_quantity
column so the correct
209

Advertisement

Table of Contents
loading

Table of Contents