• sql 查看表的所有键,索引信息


    select i.name,[Type]=case when i.is_unique=1 and is_primary_key=1 then '主键' 
                         when i.is_unique=1 and is_primary_key=0 then '唯一键' 
                         else '索引' end,TypeRemark=i.type_desc   
        from sys.indexes i  
         where i.[object_id]=object_id('表名') and i.name is not null 
    union   select f.name,'外键',OBJECT_NAME(f.referenced_object_id) 
        from sys.foreign_keys f   
        where f.parent_object_id=object_id('表名') 
    union    select d.name,'默认值',d.[definition] collate Latin1_General_CI_AS_KS_WS  
        from sys.default_constraints d  
        where d.parent_object_id=object_id('表名') 
    union    select c.name,'约束值',c.definition collate Latin1_General_CI_AS_KS_WS  
        from sys.check_constraints c  
        where c.parent_object_id=object_id('表名') 
  • 相关阅读:
    JS和Flash相互调用
    xml的应用
    随机验证码
    模块 time
    第一天 注册成功
    我的第一篇博客
    git
    2018-02-27
    25
    建站之星
  • 原文地址:https://www.cnblogs.com/you000/p/2943577.html
Copyright © 2020-2023  润新知