IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 Query to fetch rows that contains spaces in columns


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajkumarmf1985

New User


Joined: 09 Aug 2010
Posts: 18
Location: bangalore

PostPosted: Thu Jan 31, 2013 3:36 pm
Reply with quote

HI ,

I have to fetch the rows which contains the values like below.

RAJ KUMAR = there is one space between RAJ and KUMAR.

usually values will be like this. Now i have to fetch the rows which contains more than one space between the values in VARCHAR field column like below.

RAJA ##### VENKAT (# = space)
Can anyone please suggest how to get this...?

Thanks in Advance,
Raj kumar
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 275
Location: Mumbai

PostPosted: Thu Jan 31, 2013 4:18 pm
Reply with quote

Hi,

Try below sql

Code:
SELECT * FROM
TABLE NAME
WHERE LOCATE('  ',RTRIM(COLUMN-NAME)) > 0


First string in locate function is Twp Spaces as you need more than one space in column

Regards,
Chandan
Back to top
View user's profile Send private message
rajkumarmf1985

New User


Joined: 09 Aug 2010
Posts: 18
Location: bangalore

PostPosted: Thu Jan 31, 2013 5:07 pm
Reply with quote

Thanks ..chandan It's working fine.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 4
No new posts To get the count of rows for every 1 ... DB2 3
No new posts RC query -Time column CA Products 3
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top