Subject | Re: [firebird-support] Non Case Sensitive Search |
---|---|
Author | Pavel Menshchikov |
Post date | 2005-08-14T06:18:42Z |
Hello,
r> Is there a way to turn off case sensitivity when running a query with
r> a WHERE clause like this:
r> WHERE FIRST_NAME LIKE('j%')
No, LIKE is case-sensitive. CONTAINING is case-insensitive.
You could try
where Upper(FIRST_NAME) like 'J%'
(I mean you upper-case the expression for LIKE in your application,
i.e. on client)
or
where Upper(FIRST_NAME) like Upper('j%')
And you know that it doesn't even try to use an index for FIRST_NAME
(if exists). You could also add a proxy field, which is populated in
triggers with upper-cased values of an original field, and then
where FIRST_NAME_PROXY like 'J%'
or
where FIRST_NAME_PROXY like Upper('j%')
or
where FIRST_NAME_PROXY starting with Upper('j')
or
where FIRST_NAME_PROXY starting with 'J'
(in this case don't forget to create an index for FIRST_NAME_PROXY)
--
HTH
Best regards,
Pavel Menshchikov
http://www.ls-software.com
r> Is there a way to turn off case sensitivity when running a query with
r> a WHERE clause like this:
r> WHERE FIRST_NAME LIKE('j%')
No, LIKE is case-sensitive. CONTAINING is case-insensitive.
You could try
where Upper(FIRST_NAME) like 'J%'
(I mean you upper-case the expression for LIKE in your application,
i.e. on client)
or
where Upper(FIRST_NAME) like Upper('j%')
And you know that it doesn't even try to use an index for FIRST_NAME
(if exists). You could also add a proxy field, which is populated in
triggers with upper-cased values of an original field, and then
where FIRST_NAME_PROXY like 'J%'
or
where FIRST_NAME_PROXY like Upper('j%')
or
where FIRST_NAME_PROXY starting with Upper('j')
or
where FIRST_NAME_PROXY starting with 'J'
(in this case don't forget to create an index for FIRST_NAME_PROXY)
--
HTH
Best regards,
Pavel Menshchikov
http://www.ls-software.com