Subject | RE: [firebird-support] Is this a bug? (FB 2.1 <...> 2.1.2) |
---|---|
Author | Luis Madaleno - m@gnisoftR |
Post date | 2009-04-27T09:23:11Z |
Hi,
But the result is not the same for CHAR and VARCHAR fields.
It returns records for the VarChar and none for the char.
But this means that trying a LIKE '%...' on a char field only returns
records for those fields that are full filled.
In my opinion this is almost useless.
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.
I guess the only solution is to do something like this:
Select * from test1 where TRIM(tipo_doc) like '%A';
Regards,
Luis Madaleno
-----Mensagem original-----
De: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] Em nome de Leyne, Sean
Enviada: sexta-feira, 24 de Abril de 2009 18:26
Para: firebird-support@yahoogroups.com
Assunto: RE: [firebird-support] Is this a bug? (FB 2.1 <...> 2.1.2)
Dmitry,
Your reply, though, is a _little_ too brief.
The results are correct because the SQL Standard defines trailing spaces
as not significant for comparison purposes, regardless of the comparison
type (Like or =) or whether the column is defined as a CHAR/VARCHAR.
Sean
------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links
But the result is not the same for CHAR and VARCHAR fields.
It returns records for the VarChar and none for the char.
But this means that trying a LIKE '%...' on a char field only returns
records for those fields that are full filled.
In my opinion this is almost useless.
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.
I guess the only solution is to do something like this:
Select * from test1 where TRIM(tipo_doc) like '%A';
Regards,
Luis Madaleno
-----Mensagem original-----
De: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] Em nome de Leyne, Sean
Enviada: sexta-feira, 24 de Abril de 2009 18:26
Para: firebird-support@yahoogroups.com
Assunto: RE: [firebird-support] Is this a bug? (FB 2.1 <...> 2.1.2)
Dmitry,
> > Select * from test1 where tipo_doc like '%A';spaces.
> >
> > Doesn't work.
> > All field values that end with 'A' have only 2 chars.
> >
> > Can anyone confirm this?
>
> Everything works as it must work. LIKE doesn't ignore trailing
>While you are correct, results are valid.
> SY, SD.
Your reply, though, is a _little_ too brief.
The results are correct because the SQL Standard defines trailing spaces
as not significant for comparison purposes, regardless of the comparison
type (Like or =) or whether the column is defined as a CHAR/VARCHAR.
Sean
------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links