Hi,
I am loading the data into database. I have one column in target table. Its length is varchar(40), some times the Incomming data is more than 40 charactors. so those records are rejecting.
I am using trim() to remove leading charactors. But the trim is not working, what is the reason? records are rejecting even If we use trimB or Trim.
Can any one suggest on this.
Thanks in advanse
Trim the data
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
What are the "leading characters" that you want to trim? What syntax of the Trim() function you are using? TrimB() trims trailing white space characters, not leading - you need TrimF() for leading white space. Do your data in fact have leading white space?
Further, if you have 45 non-white-space characters followed or led by zero or more white space characters, Trim() will leave 45 characters.
You probably need a Left() function or substring operator, possibly in conjunction with Trim(), to achieve the effect you require; that is, to limit the output to not more than 40 characters.
Further, if you have 45 non-white-space characters followed or led by zero or more white space characters, Trim() will leave 45 characters.
You probably need a Left() function or substring operator, possibly in conjunction with Trim(), to achieve the effect you require; that is, to limit the output to not more than 40 characters.
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: 25
- Joined: Fri Jan 11, 2008 12:49 am
- Location: Pune, India
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA