View previous topic :: View next topic
|
Author |
Message |
mprabu
New User
Joined: 29 Jul 2006 Posts: 2
|
|
|
|
I have a query where data selected from table A is inserted into table B.
I want the extra spaces to be removed in one of the fields of Table A
and then inserted to table B.
Ex: 'ram and co '
should be 'ram and co'
Can this be done in the query using some functions or any logic.
Please help me. |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
What is the definition of the columns you are moving from and to?
Dave |
|
Back to top |
|
|
chiranjeevi_mca
New User
Joined: 19 Feb 2006 Posts: 27
|
|
|
|
LTRIM(RTRIM(COL1)) |
|
Back to top |
|
|
mprabu
New User
Joined: 29 Jul 2006 Posts: 2
|
|
|
|
The field is a Character of length 80.
The extra spaces i meant also include the spaces between the words.
i.e. The field can have many words but with only one space separating them.
Thanks for all your replies and this would be a Great help to me. |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Hi,
I think that there should be a function TRIM(fied_name) in DB2. If not, you can use RTRIM(LTRIM(variable)) to achieve the same. |
|
Back to top |
|
|
renjith Warnings : 1 New User
Joined: 07 Aug 2006 Posts: 11
|
|
|
|
I dont think taht TRIM() is a DB2 function.To achieve this u can use
SELECT STRIP(col1) FROM owner.table
thanks
renjith |
|
Back to top |
|
|
|