How to match percent sybmol in LIKE operator?

Поиск
Список
Период
Сортировка
Искать

How to match percent sybmol in LIKE operator?

От:
Sergey Filatov <fs@ibis.odessa.ua>
Дата:
Greetings.

My problem is to find percent character in some field.
I'm wonder how specify percent character or other wildcard characters 
in 'LIKE patterns'?

Many thanks in advance,
Sergey.

Re: How to match percent sybmol in LIKE operator?

От:
Holger Klawitter <holger@klawitter.de>
Дата:
Sergey Filatov wrote:
> 
> Greetings.
> 
> My problem is to find percent character in some field.
> I'm wonder how specify percent character or other wildcard characters
> in 'LIKE patterns'?
> 
> Many thanks in advance,
> Sergey.

You have escape them with the backslash. In order to pass the backslash
to the backend you have to escape the backslash as well:

select * from xxx where yyy like '\\%';

It might be a good idea to point this out in the Postgresql book :-)

With kind regards,
    Holger Klawitter
--
Holger Klawitter
holger@klawitter.de                             http://www.klawitter.de

SV: How to match percent sybmol in LIKE operator?

От:
"Jarmo Paavilainen" <netletter@comder.com>
Дата:
Hi,

...
> My problem is to find percent character in some field.
> I'm wonder how specify percent character or other wildcard characters 
> in 'LIKE patterns'?

If memory serves: "\%"

That is escape char and percent (in this case backslash).

// Jarmo

FAQ