SQL2005中取得表字段相关信息

SELECT
                           [Table Name] = OBJECT_NAME(c.object_id),
                           [ColumnName] = c.name,
                           [Description] = ex.value
                           FROM
                           sys.columns c
                           LEFT OUTER 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) ='Ord_M'
posted @ 2009-08-17 13:46  马建康  阅读(200)  评论(0编辑  收藏  举报