記錄查看錶的字段和說明 函數

SELECT  ( CASE WHEN a.colorder = 1 THEN d.name
               ELSE ''
          END ) 表名 ,
        a.colorder 字段序號 ,
        a.name 字段名 ,
        g.[value] AS 字段說明
FROM    syscolumns a
        LEFT JOIN systypes b ON a.xtype = b.xusertype
        INNER JOIN sysobjects d ON a.id = d.id
                                   AND d.xtype = 'U'
                                   AND d.name <> 'dtproperties'
        LEFT JOIN sys.extended_properties g ON a.id = g.major_id
                                               AND a.colid = g.minor_id
--WHERE d.[name] <>'table_desc' --你要查看的表名,註釋掉,查看當前數據庫全部表的字段信息
WHERE   d.[name] = 'Rep_HandleStats_Week'--你要查看的表名,註釋掉,查看當前數據庫全部表的字段信息
ORDER BY a.id ,
        a.colorder;

相關文章
相關標籤/搜索