Subject Re: [firebird-support] Re: Problem with : where name like '%to'
Author Helen Borrie
At 06:59 PM 11/12/2003 +1100, you wrote:
>At 07:34 AM 11/12/2003 +0000, you wrote:
>
> >So why "where name like '%to';" it's no good with firebird ?
>
>It appears to be a bug - something has certainly got broken.

OK, well, it's NOT a bug.

If you use like with a varchar, the string you supply is compared with the
final characters of the field and returns true if there is a match.

So, if you store 'Toto' and 'MacBurrito' in a varchar of any size, they
will both be returned from a LIKE '%to' search.

If you store them in a char(10), 'MacBurrito' will return true and 'Toto'
will return false, because 'Toto' is really 'Toto~~~~~~' (showing blank as
'~' here for illustration only).

Someone suggested LIKE '%to%'. This won't work. Sure, it will return the
row with 'Toto' but also 'Stoical', 'Cosytoes', etc.

heLen