Subject | Re: unpredictable behavior after changing field size |
---|---|
Author | John Caresma |
Post date | 2003-12-16T02:51:57Z |
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:
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.change a
>
> I think a need a lesson from the experts here. Recently I have
> field from a char(2) to char(3). And when Iam doing some editsupon
> posting it Iam getting a "Arithmetic overflow or division by zerohas
> accured. arithmetic exception, numeric overflow, or stringtruncation."
> While the new value Iam posting is only 3 chars I don't why thiserror
> is coming out. If what I have done is very wrong, may I know whyis this
> happening? I didn't have the same experience before in otherdatabases.
>
>
> Regards
>
> James