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: 1208
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts file manager is doing string conversion IBM Tools 3
No new posts Search string in job at regular Spool... CLIST & REXX 0
Search our Forums:

Back to Top