Subject Re: 'like' with % at the begin finds nothing
Author Roger Crämer
Thanks for the answer, but the suggestions to work around
do not help me because
o I have no influence on the db structure (it's not mine)
o To pad the compare string at the end with blanks you need to
to know the correct number of blanks at the end of the entry.

The only workaround momentarily is to search for '%bcd%' and do
some mor filtering on application level.



--- In, Nando Dessena <nando@...> wrote:
> Roger,
> R> given a small table
> R> table t ( v char(10) )
> R> with only one entry:
> R> insert into t ( v ) values ( 'abcd' )
> this is actually 'abcd ', since the column is a char (as opposed
> to a varchar).
> R> the following select does not find any entry:
> R> select * from t where v like '%bcd'
> as designed. Strings are padded for comparison (for example when you
> use =), but not when using LIKE. This is standard-compliant. You might
> want to do one of the following:
> - switch from char to varchar
> - pad the argument of LIKE with spaces to the column length.
> Ciao
> --
> Nando Dessena
> ======================================================
> I support Firebird, I am a Firebird Foundation member!
> Join today at
> ======================================================