Subject | Re: [ib-support] The comparison operator [equal] accepts blank spaces on end of expression? |
---|---|
Author | David Zvekic |
Post date | 2003-04-28T17:09:36Z |
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
> 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