Hello
Just need a small clarification...
I have a field (lets suppose COL_A) which is of CHAR data type. I changed it to VARCHAR in a later stage.
Now if i am passing a values with leading or trailing zeros and using trim function[TRIM(COL_A)] on it, then what would be output of COL_A.
Is the leading and trailing zeros will removed?
Trim of varchar
Moderators: chulett, rschirm, roy
Leading and trailing zeros will not be removed, unless you specifically ask them to be removed.
The syntax TRIM(COL_A) will trim only white space. To remove the leading zeros i think the syntax is TRIM(COL_A,'L',0') although I could have the L and the 0 around the wrong way. Similarly there is option for removing trailing characters.
The syntax TRIM(COL_A) will trim only white space. To remove the leading zeros i think the syntax is TRIM(COL_A,'L',0') although I could have the L and the 0 around the wrong way. Similarly there is option for removing trailing characters.
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
Re: Trim of varchar
For char function only trim is needed right, do we need to use it for varchar function also.. As varchar will take exactly the space required for the character.