zoukankan      html  css  js  c++  java
  • SQL server 获取各种 约束信息

    https://bbs.csdn.net/topics/380103485
     
    --获取约束信息
    select from information_schema.constraint_column_usage---可以获取指定数据库中的所有约束的信息以及约束与列的对应关系
    go
     
    select from information_schema.constraint_table_usage---查询结果中只包含表和约束的对应关系,并没有约束对应的列信息
    go
     
    select from information_schema.table_constraints---查询结果中只包含表和约束的对应关系,并没有约束对应的列信息
    go
     
    select from information_schema.key_column_usage---可以获取指定数据库中的所有键约束的列信息,包括主键约束中的主键列,唯一约束中的唯一键列和外键约束中的引用列
    go
     
    select from sys.key_constraints----获取约束信息
     
    select from sys.foreign_keys--获取表中的外键约束
     
    select from sys.foreign_key_columns--获取外键约束的列信息
     
    select from information_schema.referential_constraints--获取外键约束信息
     
    select from information_schema.check_constraints--获取检查约束信息
  • 相关阅读:
    MySQL之增_insert-replace
    Linux如何配置bond
    行转列及列转行查询
    SELECT中常用的子查询操作
    SELECT中的多表连接
    MySQL最常用分组聚合函数
    SELECT中的if_case流程函数
    MySQL常用日期时间函数
    MySQL常用数值函数
    dnslog注入
  • 原文地址:https://www.cnblogs.com/LuoEast/p/14145482.html
Copyright © 2011-2022 走看看