Subject Re: Corrupt database
Author zifnabbe
> If this is related to your previous Restore problem, then it seems
likely
> you have a "rogue" character occupying a column that is a foreign
key. You
> could write a stored procedure that loops through the table as a
cursor,
> writing the value from the problem column into a variable of the
correct
> character set.

Yes, it is related with the previous restore problem.

What do you mean with "rogue" character?
Do you mean by this a wrong value?

> declare variable fkvalue varchar(n) character set ISO_8859_1;
> FOR SELECT PK_PERSONS FROM PERSONS
> FOR UPDATE
> INTO :FKVALUE
> AS CURSOR MYCURSOR
> DO
> BEGIN
> // if it's not Fb 1.5, you'll need to put some do-nothing
code in here
>
> END
>
> When the loop encounters the bad character, it will throw the
exception you
> have seen elsewhere. Use the GDSCODE to trap the faulty value:
>
> WHEN GDSCODE transliteration_failed do
> begin
> update persons
> set pk_persons = null
> where current of mycursor;
> end
> end
> If you can't set the value to null (because it is not a nullable
column)
> then you'll need to prepare a "dummy parent" beforehand, by
creating a
> master record with a pk value that is empty string. Commit it, of
course.
>
> Then your sp can do
>
> set pk_persons = ''
> where current of mycursor;
>
> /heLen

Thanks, I'll try this out.

Regards,
Tom