Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread LIKE underscore _ acting as a wildcard, how to escape it?
Sat, Aug 6 2022 3:40 PMPermanent Link

Fady Geagea

Hello,

I've been querying for PREFIX_%, hoping to find all records that start with 'PREFIX_', and noticed that it also included records such as 'PREFIX2...', where the underscore turned out to be a wildcard.

How should one proceed to search for an actual underscore character, using the LIKE operator?

Thanks!
Sun, Aug 7 2022 2:31 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Fady


Example from the manual

SELECT *
FROM customers
WHERE Notes COLLATE ANSI_CI LIKE '%angry%'
-- The following uses the LIKE operator's
-- ESCAPE clause to perform a search on a
-- phrase that includes the percent (%)
-- character
SELECT *
FROM Orders
WHERE AdjustmentNotes LIKE '20/%' ESCAPE '/'



Roy Lambert
Sun, Aug 7 2022 2:35 PMPermanent Link

Fady Geagea

Roy Lambert wrote:

Fady


Example from the manual

SELECT *
FROM customers
WHERE Notes COLLATE ANSI_CI LIKE '%angry%'
-- The following uses the LIKE operator's
-- ESCAPE clause to perform a search on a
-- phrase that includes the percent (%)
-- character
SELECT *
FROM Orders
WHERE AdjustmentNotes LIKE '20/%' ESCAPE '/'



Roy Lambert


Hello Roy,
thanks for your reply, it worked.  Though I could not find this info in the SQL reference.  Would you mind sharing the link of the doc where this info is available?

Thanks!
Mon, Aug 8 2022 12:36 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Fady


I looked it up in the pdf help file

Roy Lambert
Wed, Aug 10 2022 3:57 PMPermanent Link

Raul

Team Elevate Team Elevate

On 8/7/2022 2:35 PM, Fady Geagea wrote:
> Hello Roy,
> thanks for your reply, it worked.  Though I could not find this info in the SQL reference.  Would you mind sharing the link of the doc where this info is available?
>

it's under comparison operators in the SQL manual

https://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=Comparison_Operators

Raul
Image