By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,280 Members | 1,693 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,280 IT Pros & Developers. It's quick & easy.

_ in LIKE

P: n/a
Hi!

Is there a way to include the character _ in the search string in LIKE
clause?
The default behaviour is:
- _ replace one character
- % replace many characters

If I write something like:
SELECT WORD FROM DICTIONARY WHERE KEY LIKE 'BLAG_%'
this would return
BLAG_0001, BLAG_0002, .. but not BLAGb0001, .....

Best regards,
Kovi

--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Oct 3 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello.

Try this:
WHERE KEY LIKE 'BLAG\_%' ESCAPE '\'

This described in
http://publib.boulder.ibm.com/infoce...n/r0000751.htm
Hi!

Is there a way to include the character _ in the search string in LIKE
clause?
The default behaviour is:
- _ replace one character
- % replace many characters

If I write something like:
SELECT WORD FROM DICTIONARY WHERE KEY LIKE 'BLAG_%'
this would return
BLAG_0001, BLAG_0002, .. but not BLAGb0001, .....

Best regards,
Kovi

--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Oct 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.