导出
select 'export to E:\FgwsDataCenter\sl_'||rtrim(tabschema) ||'_'|| rtrim(tabname)||'.ixf of ixf MESSAGES E:\FgwsDataCenter\sl_'||rtrim(tabschema) ||'_'|| rtrim(tabname)||'.log select A.* from '||rtrim(tabschema) ||'.'|| rtrim(tabname)||' A; ' from syscat.tables where tabschema = 'ESTATE' and type='T'
导入
select 'import from E:\FgwsDataCenter\sl_'||rtrim(tabschema)||'_'|| rtrim(tabname)||'.ixf of ixf MESSAGES E:\FgwsDataCenter\sl_'||rtrim(tabschema) ||'_'|| rtrim(tabname)||'.log replace_create into '||rtrim(tabschema) ||'.'|| rtrim(tabname) ||' in tsfgws index in tsfgws ; ' from syscat.tables where tabschema = 'ESTATE' and type='T'
去外键
SELECT 'ALTER TABLE '||rtrim(fktable_schem)|| '.'||rtrim(fktable_name)|| ' DROP FOREIGN KEY '||rtrim(fk_name)|| ';' FROM SYSIBM.SQLFOREIGNKEYS where fktable_schem in ('DOCUMENT','ESTATE','FCXXBMS','FINANCE','HSSYSTEM','IMG2008','REGISTER','SECONDHAND','SEMISTATIC','TENANCY','SYSTEM')
SELECT * FROM SYSIBM.SYSCOLUMNS where generated='A'
去自增长
SELECT 'ALTER TABLE '||rtrim(tbcreator)||'.'||rtrim(TBName)||' ALTER COLUMN '||rtrim(Name)||' DROP IDENTITY ;' FROM SYSIBM.SYSCOLUMNS where tbcreator='DTEST' and generated='A'