生成删除所有外键的语句
SELECT
‘ALTER TABLE ‘||tabschema||‘.‘|| SUBSTR(TABNAME,1,50)||
‘ DROP FOREIGN KEY ‘ || CONSTNAME || ‘;‘
FROM
SYSCAT.REFERENCES
;
产生删除所有表的SQL语句
select ‘DROP TABLE ‘||rtrim(tabschema)||‘.‘||t.TABNAME||‘ ;‘
from syscat.TABLES t
where tabschema like ‘%CMBBCD%‘ and t.TYPE=‘T‘
DB2查询序列的三种方式
1.
select nextval for seqName from dual
2.
select next value for seqName from dual
3.
select seqName.nextval from dual