Subject Fixing a varchar field
Author eddressel
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?

Thank you,

Ed Dressel