Subject | Re: [firebird-support] How to create a string column with significant trailing spaces |
---|---|
Author | Ivan Prenosil |
Post date | 2006-08-25T16:38:16Z |
> There is a difference in behaviour between firebird and most other RDBMSFirebird just conforms to SQL standard, probably most other RDBMS ignore it.
> regarding string columns.
> It seems like firebird ALWAYS ignores trailing spaces in string fields
> when matching,
> while other vendors distinguish between CHAR and VARCHAR fields here,
> where VARCHAR fields are not padded automatically.
> I have a usecase where I would like to declare a database column withoutIt is standard/correct/expected behaviour. There are several ways how to make
> padding,
> i.e. the selections "WHERE col = 'xyz' " does NOT deliver rows with col
> = 'xyz ',
> while otherwise preserving the normal collation properties , like
> sorting order and similar.
search trailing-spaces sensitive:
- use "LIKE" operator instead of "="
- use padding character different from your space. Character set OCTETS
is padded by binary zero, not by space, so try this
WHERE col = _OCTETS 'xyz'
- use Firebird 2 where you can define collations that do not pad data when comparing
Ivan
http://www.volny.cz/iprenosil/interbase/