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
DB2 Enterprise Stage
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 24
- Joined: Fri Oct 01, 2004 1:43 pm
- Location: USA
Re: DB2 Enterprise Stage
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
Good luck.
-rls
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.