Subject Re: [firebird-support] Is this a bug? (FB 2.1 <...> 2.1.2)
Author Ann W. Harrison
Luis Madaleno - m@gnisoftR wrote:
>
> But the result is not the same for CHAR and VARCHAR fields.
> It returns records for the VarChar and none for the char.

Correct, and standard behavior.
>
> But this means that trying a LIKE '%...' on a char field only returns
> records for those fields that are full filled.

Yes, if you want to find strings that end with a particular set of
values, don't use a type that pads short strings with other characters.

> In my opinion this is almost useless.

It's an amusing anomaly, if you have a warped sense of humor.

> End users don't understand those technical details, and if they query for
> some field that ends with some text, they don't expect this kind of result.

If any has suggested to you that SQL is a suitable language for end
users, you have a serious grievance with that person. SQL is a language
for programmers with a warped sense of humor.
>
> I guess the only solution is to do something like this:
> Select * from test1 where TRIM(tipo_doc) like '%A';
>

Yes.

Good luck,

Ann