469,928 Members | 1,861 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,928 developers. It's quick & easy.

CHAR datatype issue

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.

Jun 28 '06 #1
1 1912
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.
Jun 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Sanjay Minni | last post: by
4 posts views Thread by TK | last post: by
14 posts views Thread by Elias Farah | last post: by
1 post views Thread by Teddy | last post: by
reply views Thread by swatisahasrabudhe | last post: by
4 posts views Thread by Abhishek | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.