SQLServer 取 字段名称 类型 字段描述 等

 SELECT 
                    字段名= convert(varchar(100), a.name),
                    表名= convert(varchar(50), d.name ),
                    类型= CONVERT(varchar(50),b.name),
                    库名= 'ServerModeXpoDemo',
                    字段说明=convert(varchar(50), isnull(g.[value],''))
                    FROM dbo.syscolumns a
                    left join dbo.systypes b on a.xusertype=b.xusertype
                    inner join dbo.sysobjects d on a.id=d.id and d.xtype='U' and d.name<>'dtproperties'
                    left join dbo.syscomments e on a.cdefault=e.id
                    left join sys.extended_properties g on a.id=g.major_id and a.colid=g.minor_id
                    left join sys.extended_properties f on d.id=f.major_id and f.minor_id=0
                    where d.name ='Car'

 

posted @ 2013-01-04 14:30  在 水 一 方  阅读(3828)  评论(1编辑  收藏  举报