Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 07:24 AM
Jane
Guest
 
Posts: n/a
Default 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
  #2  
Old November 12th, 2005, 07:24 AM
Mark A
Guest
 
Posts: n/a
Default 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.


  #3  
Old November 12th, 2005, 07:24 AM
Mark A
Guest
 
Posts: n/a
Default 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.


  #4  
Old November 12th, 2005, 07:24 AM
Mark A
Guest
 
Posts: n/a
Default 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).


  #5  
Old November 12th, 2005, 07:24 AM
Mark A
Guest
 
Posts: n/a
Default 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).


  #6  
Old November 12th, 2005, 07:24 AM
Jane
Guest
 
Posts: n/a
Default 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
  #7  
Old November 12th, 2005, 07:24 AM
Jane
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

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.