With DB2 you can only Alter a Column data type of Data type CHAR but to change it from other Data type you need to drop the table and recreate it. In case of V8 you can do an alter of the column but still there is a restriction of Alter. In case of V8 you can alter a column like you want from SMALLINT to DECIMAL(16,2) but only the new data type should be larger  than the old data type.
 
-----Original Message-----
From: Sunil Inchal [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 03, 2003 2:38 PM
To: [EMAIL PROTECTED]
Subject: [DB2EUG] ALTER TABLE QUESTION

Hi group,
 
How do I alter column type and drop a column in DB2 using ALTER TABLE or any other command?
I read in the documents that only columns with CHAR type could be altered using
ALTER TABLE <tabname>
ALTER COLUMN <column>
....
 
I want to change a SMALLINT datatype to DECIMAL(16,2). Also I need to drop an existing column.
In Informix IDS it is a very easy to perform the above using ALTER command. But I don't know how to do it in DB2.
Finally, what I did was backed up data using EXPORT utility, dropped the table and recreated with changed schema and reloaded the data using LOAD utility.
Are there any other ways to do it?
 
Thanks and regards
 
Sunil
 

Reply via email to