DB2數據庫序列的移植方法 1. 生成以下語句,得到源數據庫序列的當前值: www.2cto.com Sql代碼 SELECT 'SELECT ''CREATE SEQUENCE ' || seqname || ' START WITH '' || ' || seqname || '.nextval from sysibm.sysdummy1' FROM syscat.sequences WHERE seqtype='S' AND seqschema=CURRENT schema www.2cto.com 2. 根據第一步生成的語句,逐句執行產生建立目的數據庫序列的SQL語句,如: Sql代碼 SELECT 'CREATE SEQUENCE SEQ_CCP_CM_CLIENT_INFO START WITH ' || SEQ_CCP_CM_CLIENT_INFO.nextval from sysibm.sysdummy1 SELECT 'CREATE SEQUENCE SEQ_CCP_MM_BRODCAST_INFO START WITH ' || SEQ_CCP_MM_BRODCAST_INFO.nextval from sysibm.sysdummy1 SELECT 'CREATE SEQUENCE SEQ_CCP_MM_INDUSTRY_INFO START WITH ' || SEQ_CCP_MM_INDUSTRY_INFO.nextval from sysibm.sysdummy1 SELECT 'CREATE SEQUENCE SEQ_CCP_MM_WARN_LEVEL START WITH ' || SEQ_CCP_MM_WARN_LEVEL.nextval from sysibm.sysdummy1 SELECT 'CREATE SEQUENCE SEQ_CCP_RM_BACK_PLAN START WITH ' || SEQ_CCP_RM_BACK_PLAN.nextval from sysibm.sysdummy1 SELECT 'CREATE SEQUENCE SEQ_CCP_RM_CERT_INFO START WITH ' || SEQ_CCP_RM_CERT_INFO.nextval from sysibm.sysdummy1 SELECT 'CREATE SEQUENCE SEQ_CCP_RM_CLNT_RELATION START WITH ' || SEQ_CCP_RM_CLNT_RELATION.nextval from sysibm.sysdummy1 3. 執行第二步生成的語句。應該還可行列自動化一點,目前沒時間測試!