sexevil 发表于 2016-11-14 07:04:14

db2 modify column type

DB2 is so hard to use, also its documentation... Even such a simple operation, it takes me much time...
 
Generally, char->varchar, smallint->integer, you can just modify the column through this sql:
alter table alter column set data type
 
But, if new column type is not compatible with existing column type, you need to modify it as follows:
 
1. maybe need to export old column data
2. drop the column: alter table drop column
3. add new column: alter table add column
4. reorg table
5. maybe need to import original data
页: [1]
查看完整版本: db2 modify column type