Subject Re: unpredictable behavior after changing field size
Author John Caresma
hi there,

ok, i think i might have a solution for you. When i want to change
the datatype of my field i usually create a temporary field...

example:
alter table tablename add tempfield char(3);

... and then copy the values of the previous field to the
tempfield...

example:
update tablename set tempfield="type";

... and then drop the previous field...

example:
alter table tablename drop "type";

... and then add it again with the new datatype...

example:
alter table tablename add "type" char(3);

...and then copy the data in the tempfield to the new "type" field...

example:
update tablename set "type"=tempfield;

... and lastly drop the tempfield...

example:
alter table tablename drop tempfield;

... this solution is quite long but it solves the problem.

and also one note, your field "type" is a reserved word in interbase
or firebird, you might want to change your field naming conventions
like "type_" .... :)



Regards,

John















--- In firebird-support@yahoogroups.com, James <james_027@t...>
wrote:
> Good day.
>
> I think a need a lesson from the experts here. Recently I have
change a
> field from a char(2) to char(3). And when Iam doing some edits
upon
> posting it Iam getting a "Arithmetic overflow or division by zero
has
> accured. arithmetic exception, numeric overflow, or string
truncation."
> While the new value Iam posting is only 3 chars I don't why this
error
> is coming out. If what I have done is very wrong, may I know why
is this
> happening? I didn't have the same experience before in other
databases.
>
>
> Regards
>
> James