Subject | Re: [firebird-support] Re: Problem with : where name like '%to' |
---|---|
Author | Arno Brinkman |
Post date | 2003-12-11T10:49:24Z |
Hi,
use a UDF with function right trim.
SELECT * FROM TableX WHERE RTRIM(FieldX) LIKE '%to'
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird links :
http://www.firebirdsql.com
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Nederlandse firebird nieuwsgroep :
news://80.126.130.81
> > >So why "where name like '%to';" it's no good with firebird ?If it's difficult to change existing field CHAR to VARCHAR then you could
> >
> >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.
use a UDF with function right trim.
SELECT * FROM TableX WHERE RTRIM(FieldX) LIKE '%to'
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird links :
http://www.firebirdsql.com
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Nederlandse firebird nieuwsgroep :
news://80.126.130.81