473,466 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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
Nov 12 '05 #1
6 6286
"Jane" <ja**********@i2.com> wrote in message
news:75**************************@posting.google.c om...
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


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.
Nov 12 '05 #2
"Jane" <ja**********@i2.com> wrote in message
news:75**************************@posting.google.c om...
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


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.
Nov 12 '05 #3
> > 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
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.

One other note, DEC(7,1) take up the same space internally within DB2 as
DEC(6,1).
Nov 12 '05 #4
> > 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
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.

One other note, DEC(7,1) take up the same space internally within DB2 as
DEC(6,1).
Nov 12 '05 #5
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
Nov 12 '05 #6
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
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We...
0
by: Jane | last post by:
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...
1
by: Darius | last post by:
I was having an issue inserting data into a table in an I-Series DB2 database. The Insert statement itself is very simple: Insert into Table1 select * from Table2 These two tables have...
0
by: JohnO | last post by:
Thanks to Serge and MarkB for recent tips and suggestions. Ive rolled together a few stored procedures to assist with creating audit triggers automagically. Hope someone finds this as useful as...
13
by: Peter | last post by:
Can anyone tell me how to change the data type of a field in a table created with a make table query? The field is a binary and must be changed to text. alternately does anyone know how to specify...
138
by: Ian Boyd | last post by:
i've been thrown into a pit with DB2 and have to start writing things such as tables, indexes, stored procedures, triggers, etc. The online reference is only so helpful. The two pdf manuals are...
11
by: Mikael Arhelger | last post by:
Hello, This has been posted a few times but still I could not find a way to connect to our database. We run DB2 Express on WIN2K server with XP clients. I can ping inside network and to the...
0
by: maheshmohta | last post by:
Background Often while remodeling legacy application, one of the important tasks for the architects is to have an optimum usage of storage capabilities of database. Most of the legacy applications...
2
by: Mike | last post by:
I'm running DB2 v7 for z/OS. When I use SPUFI, SELECT CAST(6.0 AS FLOAT)/CAST(10.0 AS FLOAT) FROM SYSIBM.SYSDUMMY1 returns 0.6000000000000000E+00. When I use DSNTIAUL,DSNTEP2, or DSNALI (call...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.