ILIKE Problem?

Started by Corey W. Gibbsalmost 23 years ago2 messagesgeneral
Jump to latest
#1Corey W. Gibbs
cgibbs@westmarkproducts.com

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

#2Darren Ferguson
darren@crystalballinc.com
In reply to: Corey W. Gibbs (#1)
Re: ILIKE Problem?

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:

Show quoted text

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