
November 12th, 2005, 07:24 AM
| | | DB2: Changing Data Type from INT to DEC(6,1)
We have to change INT data type to DEC(6,1) data type because there is
a functional requirement to keep more precision. This has to be done
to our existing tables. One way is to drop, move the data to temp
table, create the table with the new data type and move the data back.
Is this the only way? Are there any alternatives?
Thanks,
-Jane | 
November 12th, 2005, 07:24 AM
| | | Re: Changing Data Type from INT to DEC(6,1)
"Jane" <jane_estrada@i2.com> wrote in message
news:75f068bb.0405110848.4953f5d7@posting.google.c om...[color=blue]
> We have to change INT data type to DEC(6,1) data type because there is
> a functional requirement to keep more precision. This has to be done
> to our existing tables. One way is to drop, move the data to temp
> table, create the table with the new data type and move the data back.
> Is this the only way? Are there any alternatives?
>
> Thanks,
> -Jane[/color]
That is basically the way it has to be done. But it is somewhat safer to
create table with a new name, move the data to the new table (export/load or
insert into select from ...), then rename the old table, then rename new
table to original name. | 
November 12th, 2005, 07:24 AM
| | | Re: Changing Data Type from INT to DEC(6,1)
"Jane" <jane_estrada@i2.com> wrote in message
news:75f068bb.0405110848.4953f5d7@posting.google.c om...[color=blue]
> We have to change INT data type to DEC(6,1) data type because there is
> a functional requirement to keep more precision. This has to be done
> to our existing tables. One way is to drop, move the data to temp
> table, create the table with the new data type and move the data back.
> Is this the only way? Are there any alternatives?
>
> Thanks,
> -Jane[/color]
That is basically the way it has to be done. But it is somewhat safer to
create table with a new name, move the data to the new table (export/load or
insert into select from ...), then rename the old table, then rename new
table to original name. | 
November 12th, 2005, 07:24 AM
| | | Re: Changing Data Type from INT to DEC(6,1)
> > We have to change INT data type to DEC(6,1) data type because there is[color=blue][color=green]
> > a functional requirement to keep more precision. This has to be done
> > to our existing tables. One way is to drop, move the data to temp
> > table, create the table with the new data type and move the data back.
> > Is this the only way? Are there any alternatives?
> >
> > Thanks,
> > -Jane[/color]
>
> That is basically the way it has to be done. But it is somewhat safer to
> create table with a new name, move the data to the new table (export/load[/color]
or[color=blue]
> insert into select from ...), then rename the old table, then rename new
> table to original name.
>[/color]
One other note, DEC(7,1) take up the same space internally within DB2 as
DEC(6,1). | 
November 12th, 2005, 07:24 AM
| | | Re: Changing Data Type from INT to DEC(6,1)
> > We have to change INT data type to DEC(6,1) data type because there is[color=blue][color=green]
> > a functional requirement to keep more precision. This has to be done
> > to our existing tables. One way is to drop, move the data to temp
> > table, create the table with the new data type and move the data back.
> > Is this the only way? Are there any alternatives?
> >
> > Thanks,
> > -Jane[/color]
>
> That is basically the way it has to be done. But it is somewhat safer to
> create table with a new name, move the data to the new table (export/load[/color]
or[color=blue]
> insert into select from ...), then rename the old table, then rename new
> table to original name.
>[/color]
One other note, DEC(7,1) take up the same space internally within DB2 as
DEC(6,1). | 
November 12th, 2005, 07:24 AM
| | | Re: Changing Data Type from INT to DEC(6,1)
Mark,
Thanks for your answer. We are using DB2 8.1.3 and I was hoping such
data type conversions are possible.
You are correct renaming the table is safer and that is what we are
planning to do.
Thanks,
-Jane | 
November 12th, 2005, 07:24 AM
| | | Re: Changing Data Type from INT to DEC(6,1)
Mark,
Thanks for your answer. We are using DB2 8.1.3 and I was hoping such
data type conversions are possible.
You are correct renaming the table is safer and that is what we are
planning to do.
Thanks,
-Jane | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 205,248 network members.
|