On 3/27/07, Robert L Cochran <[EMAIL PROTECTED]> wrote:

Hi Joel,

It's been a while since I've had to code DB2 and my memory might be
faulty. But the SQL standard says char(n) has to be padded with trailing
spaces, right? See this http://troels.arvin.dk/db/rdbms/
under the heading "The CHAR type".

Thanks

Bob Cochran


Hi Bob,

There was never a question about WHY the blanks were there, just how they
were treated in SELECT statement matching.   And (not that this has anything
to do with anything), on DB2 for AS/400, SQL is not typically used to create
schema (or at least not has been in the past), but rather the AS/400
proprietary commands and DDS file structure.

But character fields on the 400 are padded with trailing blanks, regardless
of how they are created.  Here is the difference:

In the database, pretend I have a field called NAMEFIELD, defined as
CHAR(15).  In the database, it's value is 'MIKE           '

SELECT *
FROM MYFILE
WHERE NAMEFIELD = 'MIKE'

will return this row.

That is NOT true for SQLite, which would require the full 15 characters,
blanks and all, to return the row.  That is all my original message was
asking about.

Thanks,

--
Joel Cochran

Reply via email to