1. 程式人生 > >記錄查看表的字段和說明 函數

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

sta else log val .com image ner cnblogs end

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;

技術分享

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