By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,590 Members | 2,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,590 IT Pros & Developers. It's quick & easy.

Alter column precision

P: 1
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
Share this Question
Share on Google+
2 Replies


P: 10
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

P: 4
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.