Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
DB2 Query to fetch rows that contains spaces in columns

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: DB2 Query to fetch rows that contains spaces in columns
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: 269
Location: Mumbai

PostPosted: Thu Jan 31, 2013 4:18 pm    Post subject:
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    Post subject: Reply to: DB2 Query to fetch rows that contains spaces in co
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us