Sql 查询表中字段的说明

SELECT t.[name] AS TableName, --表名
c.[name] AS ColName,    --字段名
cast(ep.[value]   as varchar(100)) AS ColDescription    --说明
  FROM sys.tables  t 
  INNER JOIN sys.columns     c 
  ON t.object_id = c.object_id 
  LEFT JOIN sys.extended_properties  ep  
  ON ep.major_id = c.object_id AND ep.minor_id = c.column_id 
  WHERE  t.[name]='shopapplication' --表名
  and c.[name] = 'ID' --字段

 

posted @ 2013-02-01 09:46  xfyn  阅读(545)  评论(0编辑  收藏  举报