shsandeep wrote:
Hi,
I have a column of datatype CHAR(20).
When the DataStage job loads data of length 15 into it, it pads the
remaining 5 spaces with blank space.
This is happening with all CHAR datatype fields.
Is there any global setting which is causing this? Any other ideas?
Thanks in advance.
Cheers,
San.
This is the standard behavior for CHAR columns, in every DBMS I know
about. If you don't want this padding behavior, recreate the database
with CHAR(20) replaced by VARCHAR(20). In general it's good practice to
use VARCHAR whenever the length is greater than one and you're not sure
every value will be the same length. state_abbr char(2) vs state_name
varchar(20) demonstrates the different usages quite well. Another
advantage is that VARCHAR columns can be resized (upward at least)
without dropping and recreating the entire table.