How to remove unwanted space at one column
Moderators: chulett, rschirm, roy
How to remove unwanted space at one column
Hi all,
Iam having a source as txt file with some columns. And Target is also txt file with transformer in between
In that, iam having one column called price with data 2495.07000000 as varchar(15).
I have convert it into decimal 19 with scale 8.
I used stringtodecimal function .When i ran the job ,everything is fine.
But a single unwanted space is appended to that column .
How can remove that space .
Plz help me out.
Iam having a source as txt file with some columns. And Target is also txt file with transformer in between
In that, iam having one column called price with data 2495.07000000 as varchar(15).
I have convert it into decimal 19 with scale 8.
I used stringtodecimal function .When i ran the job ,everything is fine.
But a single unwanted space is appended to that column .
How can remove that space .
Plz help me out.
Last edited by dodda on Sat May 17, 2008 6:58 am, edited 1 time in total.
Re: How to remove unwanted space at the one column
Use either Trim(columnname) or TrimB(columnname)
Reddy
A decimal column doesn't have any spaces; just when displayed.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Yes, that is what the space in the display of view data or a peek stage is.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 135
- Joined: Tue Aug 14, 2007 4:27 am
- Location: Mumbai
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Read what Arnd already told you. If the data type is decimal there IS NO SPACE in the data - only when it is displayed is there a space for the (positive) sign character. If the data type is string then you can do with it whatever you wish.
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It is an artifact of the decimal number being displayed. Would they object if, instead of the space, there was a "+" sign? The only way to eliminate the displayed decimal sign space is to change the data type to string (VarChar or Char) and then to use Trim() or Convert() to get rid of it.
When you are educating them, ask which part of "no space" they don't understand.
When you are educating them, ask which part of "no space" they don't understand.
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
Right(Str("0",19) : InLink.TheString, 19)
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.
I am facing a similar kind of issue. I have to create a fixed width file, so in the sequential file I don't want any spaces before the decimal fields. i.e. if my source is 10.00, I want the output as "10.00" and not " 10.00".
I tried converting the decimal to the string and trim the space, but the moment I convert it to varchar, The result is displayed as 000.00
I also tried using this function
IF ISNULL(Read_RadiantBODDetail.Payamount1) THEN '000.00' ELSE Right(Str("0",7) : Read_RadiantBODDetail.Payamount1, 7) but the output is 000.00 only.
Can anyone suggest a possible solution to this problem?
I tried converting the decimal to the string and trim the space, but the moment I convert it to varchar, The result is displayed as 000.00
I also tried using this function
IF ISNULL(Read_RadiantBODDetail.Payamount1) THEN '000.00' ELSE Right(Str("0",7) : Read_RadiantBODDetail.Payamount1, 7) but the output is 000.00 only.
Can anyone suggest a possible solution to this problem?