Escape characters

In comp.databases.ingres, Mark Witney 
wrote:

>Dear all


>Is there a way in which the wildcards that Ingres uses (*, % and _ ) can be
>restricted/changed?

>We want to remove the underscore as a wildcard as it is part of some of our
>data and causes unexpected results from time to time!

>Any help or advice will be gratefully received!
>Many thanks
>Mark


Mark:

You need to use an escape value:

To find all rows where bar begins with the string "john_", use the
following SQL:

SELECT *
FROM    foo
WHERE foo.bar like 'john\_%' escape '\'

You can use any character for your escape character.  The following
SQL statement is identical (functionally):

SELECT *
FROM    foo
WHERE foo.bar like 'john#_%' escape '#'

The escape character dereferences the special characteristics of the
wildcard.

Good luck!

--Kent
Kent Smith
The Palmer Group
(617) 246-1630
Ingres Q & A
Back to William's Home Page

© William Yuan 2000

Email William