MSSQL 查找用户数据库下面的表名、表说明、列名、列说明、列类型、列长度、列是否可为空相关信息

来源:互联网 发布:oracle for mac 下载 编辑:程序博客网 时间:2024/04/28 02:31
select  a.name  as '表明',ISNULL(d.value, '')AS 表说明,       a.id as '编号',b.name  as '字段' ,c.name as '字段类型',  ISNULL(e.value, '') AS 字段说明,b.length as '字段长度',isnull(b.scale,'') as '小数位数',b.isnullable AS '是否允许为NULL' from [sysobjects] a,[syscolumns] b, [systypes] c,sys.extended_properties  d,sys.extended_properties AS ewhere a.[type] = 'u' and a.id=b.id and  b.xtype=c.xtype and a.id = d.major_id  AND d.minor_id = 0 and b.id = e.major_id            AND b.colid = e.minor_id  order by a.id

相关表关系:

sysobjects --表<pre name="code" class="sql">syscolumns --列<pre name="code" class="sql">systypes --类型<pre name="code" class="sql">sys.extended_properties --表说明<pre name="code" class="sql">sys.extended_properties --字段说明






0 0
原创粉丝点击