Alter DB2 identity to add Cycle Cache and a specific restart value

…衆ロ難τιáo~ 提交于 2019-12-13 00:36:34

问题


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:


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               


来源:https://stackoverflow.com/questions/28327079/alter-db2-identity-to-add-cycle-cache-and-a-specific-restart-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!