467,871 Members | 1,585 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,871 developers. It's quick & easy.

Alter column precision

I'm working with DB2 ver. 8.x and I'm trying to change the precision of decimal(10) to decimal(20). My script is:

ALTER TABLE xyz
ALTER COLUMN campo SET DATA TYPE DECIMAL(20, 0);

but I got this error:

DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: ALTER TABLE xyz
ALTER COLUM;BEGIN-OF-STATEMENT;<values> [SQL State=42601, DB Errorcode=-104]

Please help me to understand what's wrong and how can I change the precision of my field.
Thanks

goyosito
Aug 16 '07 #1
  • viewed: 9274
Share:
2 Replies
Jal
I'm working with DB2 ver. 8.x and I'm trying to change the precision of decimal(10) to decimal(20). My script is:

ALTER TABLE xyz
ALTER COLUMN campo SET DATA TYPE DECIMAL(20, 0);

but I got this error:

DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: ALTER TABLE xyz
ALTER COLUM;BEGIN-OF-STATEMENT;<values> [SQL State=42601, DB Errorcode=-104]

Please help me to understand what's wrong and how can I change the precision of my field.
Thanks

goyosito

AFAIK Alter Column only works for Varchar in DB2. Hence you cannot alter a decimal column.
If this is urgent, then create a new table and move the data to the new table and then drop the old table.

Jalaj
Aug 17 '07 #2
Decimal data type can now be altered in v9.1 and above.
alter table <tablename> alter column <colName> set data type decimal(x,y).
You can only alter upto 3 columns and then you need to ReOrg the table.
Jul 25 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Dylan Nicholson | last post: by
2 posts views Thread by RamaKrishna Narla | last post: by
7 posts views Thread by Serge Rielau | last post: by
3 posts views Thread by sparks | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.