美文网首页
【Sql】查询数据库表详细信息

【Sql】查询数据库表详细信息

作者: KevinTseng | 来源:发表于2018-06-16 10:23 被阅读0次
    SELECT a.name as '字段名',c.name '类型',sm.text as '默认值',a.isnullable as '是否为空', 
    a.length as '长度',a.xscale as '小数位数',e.value as '字段说明' 
    FROM syscolumns a  
    left join systypes b on a.xusertype=b.xusertype  
    left join systypes c on a.xtype = c.xusertype  
    inner join sysobjects d on a.id=d.id and d.xtype='U'  
    left join syscomments sm on a.cdefault=sm.id  
    left join sys.extended_properties e on a.id = e.major_id and a.colid = e.minor_id and  
    e.name='MS_Description' where d.name='category'
    

    相关文章

      网友评论

          本文标题:【Sql】查询数据库表详细信息

          本文链接:https://www.haomeiwen.com/subject/tpaveftx.html