DB2 求指导,如已有一个表 test(id,name),其中id, name 都已经有了数据。现在要将id的属性改为自增,如何来实现?
收起直接修改就行
db2 "select max(id) from test"
如果id不是not null 需要修改为not null
db2 alter table test alter column id set not null
修改为自增字段
db2 "alter table test alter column id set generated always as identity (start with 3,increment by 1)"