Alter DB2 identity to add Cycle Cache and a specif

2019-08-10 20:51发布

I want to alter a db2 identity to cycle cache and to make it (re)start with a specific value, something like:

ALTER TABLE  ALTER COLUMN  
    SET GENERATED ALWAYS AS IDENTITY (CYCLE CACHE 100) RESTART WITH 32323

Is there a way of doing this so that I can add cycle cache as well as make it restart from a specific number?

1条回答
欢心
2楼-- · 2019-08-10 21:20

What error are you seeing? What version and platform of DB2?

The following works on DB2 for IBM i 7.1

alter table mytable       
alter column mycolumn     
  set generated always    
  set cycle               
  set cache 100           
  restart with 32323      

This worked also

alter table mytable                
alter column mycolumn              
  set generated always as identity 
  set cycle                        
  set cache 100                    
  restart with 32323               
查看更多
登录 后发表回答