Subject Re: [ib-support] Case Sensitivity on Indices
Author Helen Borrie
At 12:02 PM 14/01/2003 -1000, you wrote:
>Aloha Again... Thanks so much for the advice given so far. I've
>downloaded more manuals than I've time to read, but am making a lot of
>progress on identifying the conversion (DBISAM -> FB) issues.
>
>In DBISAM, there is the ability to indicate that an index is not case
>sensitive. Thus, "Abc" would be right next to "ABC" rather than far apart
>in the index, the thus (I believe) optimize a query on the field.

Optimize it? How could a process that needs to convert values for
comparison be optimal?


>I can't seem to find such an animal in FB. Would something this work:?
>
>Select * from Clients where Upper(Clients.Name) like 'SMITH%'

Yes.

If you have certain char or varchar columns that need a case-insensitive
search frequently, create an additional column of the same length which is
populated automatically by before insert and before update triggers and
stores your value as upper case. Index this proxy search column instead of
the actual column.

e.g.

create trigger bi_proxy_last_name for customer
active before insert position 0
as
begin
if (new.last_name is not null) then
new.proxy_last_name = upper(new.last_name);
end

create trigger bu_proxy_last_name for customer
active before update position 0
as
begin
if (new.last_name <> old.last_name
and new.last_name is not null) then
new.proxy_last_name = upper(new.last_name);
end

heLen