Problem trimming a db2 char datatype value
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 87
- Joined: Mon Feb 18, 2008 3:58 pm
- Location: Sacramento, CA
Problem trimming a db2 char datatype value
I am trying to trim a field whose datatype is char(5) in db2 database.I am setting APT_STRING_PADCHAR to "0*20".In the transformer I am trying to capture all non-nulls into 1 link and null values link into another by using proper constraint condition Len(trim(field1))=0 but everything is going into non nullable link.Could anyone please suggest me what should I do to trim those unwanted characters coming from database table.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Why not use IsNull() in the constraint expression?
Then you can properly Trim() strings on the other link, provided that the output column is VarChar. If the output column is of type Char, then the pads will be replaced after the Trim() has been applied.
Then you can properly Trim() strings on the other link, provided that the output column is VarChar. If the output column is of type Char, then the pads will be replaced after the Trim() has been applied.
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.
-
- Premium Member
- Posts: 87
- Joined: Mon Feb 18, 2008 3:58 pm
- Location: Sacramento, CA
Thanks Ray I tried that but its not working.I used isnotnull(field1) and isnull(field1) but still its not working and all the records are going into the not null link as unknown characters are occupied in that length of 5.And more over trim would also not work as they are unknown characters from database fixed width field.
Re: Problem trimming a db2 char datatype value
Surely you mean "0x20", yes?BradMiller wrote:I am setting APT_STRING_PADCHAR to "0*20".
![Confused :?](./images/smilies/icon_confused.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 87
- Joined: Mon Feb 18, 2008 3:58 pm
- Location: Sacramento, CA
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 3
- Joined: Tue Jan 12, 2010 10:52 pm
- Location: chennai
-
- Premium Member
- Posts: 87
- Joined: Mon Feb 18, 2008 3:58 pm
- Location: Sacramento, CA