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: 271
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 Facing issue while executing multi ro... aagarwal88 DB2 6 Tue Oct 02, 2018 8:11 am
No new posts DB2 SQL Query to fetch all instances ... MallikarjunSM DB2 2 Thu Sep 27, 2018 6:46 pm
No new posts Delete Multiple rows in chunks by usi... dharmaraok DB2 5 Tue Sep 11, 2018 8:44 pm
No new posts Remove selected duplicate rows from t... hnharish DFSORT/ICETOOL 3 Wed Sep 05, 2018 3:11 am
No new posts Generate SQL query dynamically using ... vnktrrd DB2 7 Tue Aug 28, 2018 8:11 pm

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