Hi,
My job is fetching data from netezza database , doing transformations in transformer stage and writing to netezza daatbase.
In the transformer I am using the transformation len(trim(column1)) where column1 is having datatype char2 . I can see all the input value for column1 is '5' , but the transformer output shows 2 where as the expected value is 1 .
I tried with the transformation len(trimb(trimf(column1))) but the same result.
Please advise any way to trim the column1
trim function not working
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
Your char field will always have a length of 2, that's the way CHAR works. It won't have "5" in it, it will have "5 " in it and even if you trim them, any trailing spaces will be automagically added back in. Again, all part of the nature of a CHAR field.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Re: trim function not working
Simply assign the value to a stage variable with type VARCHAR(2) and use it in the output column of type VARCHAR(2) with trim function
Last edited by rahcomp on Thu Apr 19, 2012 10:41 am, edited 1 time in total.
Rahul
DS Lover
DS Lover
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
Re: trim function not working
Why in this world someone will truncate the string to from 2 characters to 1 character just because he is not able to trim it?rahcomp wrote:Simply assign the value to a stage variable with type VARCHAR(1) or CHAR(1) and use it in the output column of type VARCHAR(N) or CHAR(1)
what if you get a two character string in input?
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.
Genius may have its limitations, but stupidity is not thus handicapped.