Subject | RES: [ib-support] The comparison operator [equal] accepts blank spaces on end of expression? |
---|---|
Author | Enio Bueno |
Post date | 2003-04-28T19:10:26Z |
Hi David
The FIELDX is varchar(60)
I try WHERE fieldx = cast('test ' as varchar(60))
and WHERE CAST(fieldx as varchar(60)) = cast('test ' as varchar(60))
but don't work, i always receive the row.
-----Mensagem original-----
De: David Zvekic [mailto:dzvekic@...]
Enviada em: segunda-feira, 28 de abril de 2003 14:10
Para: ib-support@yahoogroups.com
Assunto: Re: [ib-support] The comparison operator [equal] accepts blank
spaces on end of expression?
enio_bueno wrote:
The SQL standard defines that trailing spaces are not considered significant
on a column of type CHAR.
you could try type casting 'test ' and FIELDX as a VARCHAR to force the
significance of the trailing spaces.
WHERE CAST(fieldx as varchar(20)) = cast('test ' as varchar(20))
ought to do the trick
David Z
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
The FIELDX is varchar(60)
I try WHERE fieldx = cast('test ' as varchar(60))
and WHERE CAST(fieldx as varchar(60)) = cast('test ' as varchar(60))
but don't work, i always receive the row.
-----Mensagem original-----
De: David Zvekic [mailto:dzvekic@...]
Enviada em: segunda-feira, 28 de abril de 2003 14:10
Para: ib-support@yahoogroups.com
Assunto: Re: [ib-support] The comparison operator [equal] accepts blank
spaces on end of expression?
enio_bueno wrote:
> if there is a row with 'test'What is the datatype of FIELDX?
> The following statement
> [SELECT * FROM TABLEX WHERE FIELDX = 'test']
> returns the row, but
> [SELECT * FROM TABLEX WHERE FIELDX = 'test ']
> or
> [SELECT * FROM TABLEX WHERE FIELDX = 'test ']
> returns too
>
> Are there how to prevent this?
>
>
The SQL standard defines that trailing spaces are not considered significant
on a column of type CHAR.
you could try type casting 'test ' and FIELDX as a VARCHAR to force the
significance of the trailing spaces.
WHERE CAST(fieldx as varchar(20)) = cast('test ' as varchar(20))
ought to do the trick
David Z
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/