Subject Re: [firebird-support] Corrupted data FB 1.5
Author Ivan Prenosil
> Have a case of a FB 1.5 (Classic) database on Windows where certain records
> in two fields of one table show fine in one application, but show truncated
> in another, that is only the first 4 characters show. First application
> accesses the database via the API and the second via ODBC.
>
> This is the schema of that table:
>
> CREATE TABLE ADDRESS(
> ADDRESS_ID INTEGER NOT NULL,
> ADDRESS_LINE_1 VARCHAR(40),
> POSTCODE CHAR(10),
> UPDATED_DATE INTEGER,
> ADDRESS_LINE_2 VARCHAR(40),
> ADDRESS_LINE_3 VARCHAR(40),
> ADDRESS_LINE_4 VARCHAR(40),
> ADDRESS_LINE_5 VARCHAR(40))
>
> The problem shows in ADDRESS_LINE_3 and ADDRESS_LINE_4, but only in a few
> records.
> ADDRESS_LINE_2 has an index, but ADDRESS_LINE_2 hasn't.
>
> The question is how to figure out what is wrong with the particular records.
> My guess is that somehow wrong characters
> got into the text, maybe Chr(0), but I can't see it in my programming
> environment, which is VB.
> Is there a way with SQL to see what might be the trouble here?

If the problem is caused by binary zero in your data, you can find such rows this way

SELECT * FROM ADDRESS
WHERE ADDRESS_LINE_3 CONTAINING CAST('' AS CHAR(1) CHARACTER SET OCTETS)

Ivan
http://www.volny.cz/iprenosil/interbase/