How to remove the padding charachers from a string
Moderators: chulett, rschirm, roy
How to remove the padding charachers from a string
Does any one know how to remove the padding charactors like 0x0 from a string?
Thanks in advance
Thanks in advance
Bill
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Remember that CHAR fields aren't trimmed, a Char(5) string with "hi " is still "hi " after TRIMming.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I stand corrected and am appropriately
Code: Select all
"chastised "
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 221
- Joined: Fri Feb 17, 2006 3:38 am
- Location: India
- Contact:
We had similar problems in our case where a Char(0) characted is getting appended at the end of the string. Even though the Trim function is applied in the source extraction query or the transformer after that then also it is not getting removed.chulett wrote:It probably works fine but then they get added right back on. How about more details about what exactly you are doing where and what the end result is you are trying to achieve? ...
Then we tried a weird solution. Initially extract the data and put it in a Dataset. Then we read the dataset and applied function
Code: Select all
Trim(<Col name>,Char(0),'A')
Thanks & Regards
Parag Saundattikar
Certified for Infosphere DataStage v8.0
Parag Saundattikar
Certified for Infosphere DataStage v8.0
Hi Everyone,
Thanks for all valuable inputs.
This issue has been solved now.
The details that we did here are:
The source data field is Varchar. The target file we produced is defined as Char field. The Char(0) charactor was padded in the ETL processes because the Environment Variable used for padding defaults as Char(0). I had tried to use Trim function but it would not work. All we did is to change Char fields to Varchar in the ETL processes. It works now but spenting a lot of time.
Thanks for all valuable inputs.
This issue has been solved now.
The details that we did here are:
The source data field is Varchar. The target file we produced is defined as Char field. The Char(0) charactor was padded in the ETL processes because the Environment Variable used for padding defaults as Char(0). I had tried to use Trim function but it would not work. All we did is to change Char fields to Varchar in the ETL processes. It works now but spenting a lot of time.
This code is very good. I will try to use this if the problem comes again.Code:
Trim(<Col name>,Char(0),'A')
Bill