Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us