13590--北极燕鸥


   博采众长,信誉卓著

导航

工作用脚本

Posted on 2011-03-11 10:38  北极燕鸥  阅读(439)  评论(0编辑  收藏  举报

导出
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'