zoukankan      html  css  js  c++  java
  • 【转】Informix数据表结构分析资料整理之约束查询代码

    原文地址:http://blog.csdn.net/xqf222/article/details/6271219

    本文主要整理了Informix数据库相关系统表数据,已分析整个Informix数据表结构,同时方便代码自动生成.
    提示一:systables 存放Informix数据库中所有数据表相关数据

    提示二:sysconstraints 存放Informix数据库中所有约束相关数据


    --获取所有用户表的主键约束名称
    select a.tabname,b.constrname,b.* from systables a  join sysconstraints b on a.tabid=b.tabid   where a.tabid >99 and a.tabtype='T' and b.constrtype ='P' order by a.tabname
    --获取所有未设置主键的用户数据表OK
    Select * from systables a where tabid >99 and tabtype='T' and not exists (Select 1 from sysconstraints b where a.tabid=b.tabid and b.constrtype ='P');

    --获取所有用户表的外键约束名称
    select a.tabname,b.constrname from systables a  join sysconstraints b on a.tabid=b.tabid   where a.tabid >99 and a.tabtype='T' and b.constrtype ='R' order by a.tabname
    --获取所有未设置外键约束的用户数据表OK
    Select * from systables a where tabid >99 and tabtype='T' and not exists (Select 1 from sysconstraints b where a.tabid=b.tabid and b.constrtype ='R');

    --获取所有用户表的检查约束名称
    select a.tabname,b.constrname from systables a  join sysconstraints b on a.tabid=b.tabid   where a.tabid >99 and a.tabtype='T' and b.constrtype ='C' order by a.tabname
    --获取所有未设置检查约束的用户数据表OK
    Select * from systables a where tabid >99 and tabtype='T' and not exists (Select 1 from sysconstraints b where a.tabid=b.tabid and b.constrtype ='C');

    --获取所有用户表的唯一约束名称
    select a.tabname,b.constrname from systables a  join sysconstraints b on a.tabid=b.tabid   where a.tabid >99 and a.tabtype='T' and b.constrtype ='U' order by a.tabname
    --获取所有未设置唯一约束的用户数据表OK
    Select * from systables a where tabid >99 and tabtype='T' and not exists (Select 1 from sysconstraints b where a.tabid=b.tabid and b.constrtype ='U');

    --获取所有用户表的非空约束名称
    select a.tabname,b.constrname from systables a  join sysconstraints b on a.tabid=b.tabid   where a.tabid >99 and a.tabtype='T' and b.constrtype ='N' order by a.tabname
    --获取所有未设置非空约束的用户数据表OK
    Select * from systables a where tabid >99 and tabtype='T' and not exists (Select 1 from sysconstraints b where a.tabid=b.tabid and b.constrtype ='N');

  • 相关阅读:
    二维码登录网页版微信的实现方式分析
    扒取网站内容(后台方法和前台方法的两种实现)
    网站基本架构模式以及优化方案
    JS 日期对象在浏览器间的若干差异
    Web Farm 和Web Garden
    邓白氏申请和查询
    Xcode 真机调试报错:This application's application-identifier entitleme
    libc++abi.dylib`__cxa_throw: 使用[AVAudioPlayer play]会产生__cxa_throw异常
    ios 瀑布流的那些事情
    ios UIImage 圆形图片剪切方案
  • 原文地址:https://www.cnblogs.com/catkins/p/5396346.html
Copyright © 2011-2022 走看看