Subject | Re: SELECT ... WHERE ... LIKE ... question (Firebird 1.02) |
---|---|
Author | wackoj123 <wackoj123@yahoo.com> |
Post date | 2003-02-13T19:34:21Z |
Hi Luc,
SELECT Code FROM <Table> WHERE Code = "01AB"
does return this code; in this case SELECT does not have a problem
with the 4 or 5 characters (I have tested this to make sure this is
correct :-)).
return codes like __ABC - and I do not want those... :-)
it is two I add a space and use that result for the query. Not pretty
but it works.
results, while a plain query without wildcards works perfectly.
Best regards,
Jack
> So asking for a LIKE '__AB' will never get you any resultThen this is a "feature" of LIKE... Because
> back since ALL fields in the char column have a fix
> length of five and your asking for 4 chars.
>
> You may change your column to VARCHAR, make sure you trim
> the values and it will work.
SELECT Code FROM <Table> WHERE Code = "01AB"
does return this code; in this case SELECT does not have a problem
with the 4 or 5 characters (I have tested this to make sure this is
correct :-)).
> If you stay with CHAR(5) you can use:That would not be an option in this case, because this will also
>
> LIKE '__AB%'
return codes like __ABC - and I do not want those... :-)
> In this case you will get 01AB, but not 01DABWhat I have done now is check the length of the part after __ and if
>
> so, maybe:
>
> LIKE '__AB%' or LIKE '___AB' will do it, too.
it is two I add a space and use that result for the query. Not pretty
but it works.
> See above.But then again, as mentioned above the LIKE is the only not returning
> It has nothing to do with LIKE, it's the CHAR definition.
results, while a plain query without wildcards works perfectly.
Best regards,
Jack