Thread: ILIKE Problem?

ILIKE Problem?

From
"Corey W. Gibbs"
Date:
Good Afternoon Everyone,

I was wondering if I am running into a problem with ILIKE.  Here is what happened:

When trying to execute this select statement:
    SELECT * from elevlist WHERE fulldwgpath ILIKE '\\\\cad_svr\\someDirectory-name-thatis-long\\somefile.dwg'
0 rows are returned, but if I shorten it to:
    SELECT * from elevlist WHERE fulldwgpath ='%somefile.dwg%'
my rows are returned.  fulldwgpath is a varchar(250) datatype.

Any ideas?
thanks in advance
corey



Re: ILIKE Problem?

From
Darren Ferguson
Date:
When you do the first one since you are not using %% values like will
treat this as = so it would have to exactly equal what you put in the
where clause. (someone correct if this is wrong but i believe it is correct)

In the second one you use the % which means it appears anywhere in the
string i.e.

%test - will return test, atest, and test would have to be the last word
in the string.

test% - will return test as the first word followed by anything else

%test% - will return any string with the text "test" in it.

test - will be the same as evlvlist = 'test'

HTH
Darren

Corey W. Gibbs wrote:

>Good Afternoon Everyone,
>
>I was wondering if I am running into a problem with ILIKE.  Here is what happened:
>
>When trying to execute this select statement:
>    SELECT * from elevlist WHERE fulldwgpath ILIKE '\\\\cad_svr\\someDirectory-name-thatis-long\\somefile.dwg'
>0 rows are returned, but if I shorten it to:
>    SELECT * from elevlist WHERE fulldwgpath ='%somefile.dwg%'
>my rows are returned.  fulldwgpath is a varchar(250) datatype.
>
>Any ideas?
>thanks in advance
>corey
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/docs/faqs/FAQ.html
>
>