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

use of % in a VARCHAR string


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
neelesht

New User


Joined: 24 Jul 2006
Posts: 99
Location: Los Angeles

PostPosted: Mon Oct 09, 2006 2:25 pm
Reply with quote

Hi All,

If I have a string as 'NEEL%SH' then how would I use the LIKE query for this particular string, suppose in LIKE I want to give"NEEL%" as first 5 characters.

Please let me knw what will be the query and also let me know is it allowed to use '%' in the VARCHAR string.

Thanks
Neelesh
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1209
Location: Bangalore,India

PostPosted: Thu Oct 12, 2006 11:03 am
Reply with quote

Hi there,

U can use escape along with like
escape-expression
This optional argument is an expression that specifies a character to be used to modify the special meaning of the underscore (_) and percent (%) characters in the pattern-expression. This allows the LIKE predicate to be used to match values that contain the actual percent and underscore characters.

For ur query u can use

Code:
Where col_name  LIKE 'NEEL\%%' ESCAPE '\';


Hope it will helpful
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Converting VARCHAR to XML DB2 1
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts ICETOOL to SUM String DFSORT/ICETOOL 1
No new posts Mark Previous & next lines when a... DFSORT/ICETOOL 9
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
Search our Forums:


Back to Top