Subject Re: [firebird-support] Fixing a varchar field
Author Martijn Tonies
> At 09:55 AM 3/04/2009, you wrote:
>>Some time ago I made a mistake and changed a field from Varchar 50 to 30
>>without checking that the all the data fit. Oops. Now I am trying to fix
>>the data.
>>
>>I look through each record and see if the field is greater then 30
>>characters -- I can get the value by casting it as a varchar(50). Works
>>fine.
>>
>>But when I try to assign the field value back, even though I have reduced
>>the string size, I get the exception:
>>
>> Arithmetic overflow or division by zero has occurred.
>> arithmetic exception, numeric overflow, or string truncation.
>>
>>Here is my simple SQL for updating the value:
>>
>> Update CashInfusionInfo
>> set SOME_NAME = :Name
>> where SOME_ID = :lID
>>
>>I opened IBExpert and tried the same thing, it fails as well.
>>
>>How can I reduce the string size? Do I first need to increase the varchar
>>field, check it, then reduce it?
>
> First, it's a puzzle how the engine allowed you to reduce the size of a
> varchar column that contains data. If you can reproduce such an action,
> please post a Tracker entry with a reproducible case, remembering to
> include all the details of server version, platform, database ODS and
> database dialect.
>


With IBExpert, probably a direct system table update.


/M