Subject | Problem with LIKE query and collation. |
---|---|
Author | rael_bauer |
Post date | 2010-02-18T22:36:55Z |
Hi,
I have a field LASTNAME declared as
CREATE TABLE CONTACTS (
LASTNAME VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ES_ES_CI_AI
...
);
The collation here allows me to search on terms case insensitively and also order alphabetically case insensitively. Usually this works very well.
I do queries like:
select ... TITLE, FIRSTNAME, LASTNAME, ...
from CONTACTS
where LASTNAME LIKE 'B%'
order by LASTNAME
However when the query contains:
where LASTNAME LIKE 'K%'
then ALL records of the table are returned??
Any explanation why this is happening..and how to get around this?
Thanks
Rael Bauer
I have a field LASTNAME declared as
CREATE TABLE CONTACTS (
LASTNAME VARCHAR(50) CHARACTER SET ISO8859_1 COLLATE ES_ES_CI_AI
...
);
The collation here allows me to search on terms case insensitively and also order alphabetically case insensitively. Usually this works very well.
I do queries like:
select ... TITLE, FIRSTNAME, LASTNAME, ...
from CONTACTS
where LASTNAME LIKE 'B%'
order by LASTNAME
However when the query contains:
where LASTNAME LIKE 'K%'
then ALL records of the table are returned??
Any explanation why this is happening..and how to get around this?
Thanks
Rael Bauer