--name   字段名称
--user_type_id 
--max_length 最大长度
--is_nullable 是否允许空
--remark  描述
SELECT c.name, c.user_type_id, c.max_length, c.is_nullable, remark = ex.value
FROM sys.columns c inner JOIN  sys.extended_properties ex
ON
   ex.major_id = c.object_id 
   AND ex.minor_id = c.column_id  
   AND ex.name = 'MS_Description'  
WHERE  
   OBJECTPROPERTY(c.object_id, 'IsMsShipped')=0  
   AND OBJECT_NAME(c.object_id) = 't_tableName'
ORDER  
   BY OBJECT_NAME(c.object_id), c.column_id

posted on 2016-07-08 13:47  三人乐乐  阅读(2875)  评论(0编辑  收藏  举报