Re: using CAST and LIKE

Поиск
Список
Период
Сортировка
От PG Explorer
Тема Re: using CAST and LIKE
Дата
Msg-id 000901c1e4b4$b4b9b480$c80ba8c0@sabex.com
обсуждение исходный текст
Ответ на using CAST and LIKE  (Timothy Wood <timothy@hallcomp.com>)
Список pgsql-general
It is easier to use regular expressions
I am quite sure it works with string fields and integer fields

SELECT * FROM table WHERE field ~* 'value';

~* case insensitive

http://www.pgexplorer.com


----- Original Message -----
From: "Timothy Wood" <timothy@hallcomp.com>
To: <pgsql-general@postgresql.org>
Sent: Monday, April 15, 2002 9:08 PM
Subject: [GENERAL] using CAST and LIKE


> Hi all,
>
> Sorry if this has already been posted but the archives, as you probably
> already know, aren't searchable right now and I did not see anything
> relevant when I sifted through them.  Anywho,  I'm trying to use a type
> cast in a where ... like select statement and I've done it like so:
>
> SELECT * FROM table WHERE CAST('field' AS TEXT) LIKE '%value%';
>
> now the field I'm casting, be it already of type text or not, never
> returns any rows.  However if I use a field that is already of text type
> and do not cast it then I get resluts.  So my question is is there any
> way to use CAST and LIKE together in the same select or am I
> missing/doing something wrong?  Thanks.
>
> Timothy,
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html


В списке pgsql-general по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: string encryption
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: How to Recompile Postgreqsl to increase Function-argument