zoukankan      html  css  js  c++  java
  • 查SQLSERVER MSSQL查约束是哪张表

    模板:

    获取表名及表的触发器
    select 
     (select b.name from sysobjects as b where b.id = a.parent_obj)  表名,
       a.name  as 触发器 
       from sysobjects  as a where a.xtype='TR'
    order by 表名

    实例:查一个“F = FOREIGN KEY”类型的 约束

    select * from
    (
    select 
     (select b.name from sysobjects as b where b.id = a.parent_obj)  tablename,
       a.name  as xtype 
       from sysobjects  as a where a.xtype='F'
    --
    )t where 1=1
    --and xtype='FK_MS_SFMX_REF_310_MS_MZXX'
    order by tablename

    备注:
    xtype对象类型。可以是下列对象类型中的一种:
    C = CHECK 约束
    D = 默认值或 DEFAULT 约束
    F = FOREIGN KEY 约束
    L = 日志
    FN = 标量函数
    IF = 内嵌表函数
    P = 存储过程
    PK = PRIMARY KEY 约束(类型是 K)
    RF = 复制筛选存储过程
    S = 系统表
    TF = 表函数
    TR = 触发器
    U = 用户表
    UQ = UNIQUE 约束(类型是 K)
    V = 视图
    X = 扩展存储过程

  • 相关阅读:
    BBS
    BBS
    BBS
    BBS
    6.1
    Django
    Django
    tomcat——启动项目报错:java.lang.IllegalStateException
    Java——java.lang.NullPointerException
    Java——反射三种方式的效率对比
  • 原文地址:https://www.cnblogs.com/wybshyy/p/13783647.html
Copyright © 2011-2022 走看看