Page 1 of 1

DB2 Enterprise Stage

Posted: Thu Oct 21, 2004 1:59 pm
by dsuser
We did load a table in DB2 using a DB2 Enterprise Stage fetching data from a Sybase source. There were a couple of columns with the char datatype.
When the data gets loaded and I try to retrieve the data from the table I see all the char columns have been padded with spaces. And I'm not able to do a rtrim on this. Even after a rtrim it still gives the actual length of the column and not the length of the value in that column.
I also tried this(DB2 Enterprise) with a varchar type and I see the same behaviour.

Where as I can perform an rtrim on a manually entered row and it works fine.
The same works fine when an DB2 API stage is used.

Has anybody come across this before. And is there a specific way in which DB2 Enterprise stage behaves that I'm missing on.

Thanks,
dsuser

Re: DB2 Enterprise Stage

Posted: Thu Oct 21, 2004 2:14 pm
by RobertScarbrough
I would check to see if they are really spaces. I ran into something similiar and it turned out it was because it was padded with nulls and not spaces. Using a SQL select statement on the column probably isn't going to be too helpful to determine that. Try changing the $APT_STRING_PADCHAR to be a space with no quotes and see if that helps. If not inspect one of the columns before you try and load it to the table to make sure that you have a space instead of a null.

Good luck.

-rls

Posted: Thu Oct 21, 2004 2:35 pm
by dsuser
I tried to replace a space with an empty string and it let me replace and when I did a rtrim and then found the length it gave me the right length of the value in the column which makes me guess it should be a space. replace(colname, ' ','')

Thanks,
dsuser

Posted: Thu Oct 21, 2004 3:51 pm
by ray.wurlod
Different databases handle the CHAR datatypes differently. All (necessarily) store the trailing space characters. Some mandate the trailing spaces in queries in result sets, others do not. I think you have encountered this, and have already deduced how to work around it.