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

Record value starts with '%'


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top