DB2数据库序列的移植方法
来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 17:25 点击:次
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. 执行第二步生成的语句。应该还可行列自动化一点,目前没时间测试!
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>