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
 

 

Record value starts with '%'

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Naresh Dasari

New User


Joined: 16 Oct 2007
Posts: 9
Location: Chennai

PostPosted: Fri Jun 20, 2008 11:05 am    Post subject: Record value starts with '%'
Reply with quote

Hi,
We usually give the query like the following to get the records where lastname starts with 'S'

SELECT EMPNO, LASTNAME FROM EMPLOYEES
WHERE LASTNAME LIKE 'S%'

Now, I want to acces the records where the lastname starts with '%'.
Can anyone help me hw to write a query.
Back to top
View user's profile Send private message

kapil.ksingh

New User


Joined: 21 May 2008
Posts: 1
Location: India

PostPosted: Fri Jun 20, 2008 11:37 am    Post subject:
Reply with quote

Hi,
As far as I am concern it may be like below ----


select empno,lastname from employees
where lastname like


SELECT * FROM EMP_MASTER
WHERE SUBSTR(ENAME,1,1) = '%';
Back to top
View user's profile Send private message
ascelepius

New User


Joined: 16 Jun 2008
Posts: 35
Location: bangalore

PostPosted: Fri Jun 20, 2008 11:41 am    Post subject: Reply to: Record value starts with '%'
Reply with quote

A quick look into the DB2 manuals helped recall the escape character,

you can use the query,
Code:

SELECT EMPNO, LASTNAME FROM EMPLOYEES
WHERE LASTNAME LIKE '+%%'  ESCAPE '+'
 


Thanks!
asci(i)
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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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