列出所有表的列属性,适用了SQLSERVER2008
SELECT
A.name AS table_name,B.name AS column_name,
d.name,b.max_length,b.precision,b.scale,
C.value AS column_description
FROM sys.tables A
INNER JOIN sys.columns B ON B.object_id = A.object_id
inner join sys.types d on b.system_type_id=d.system_type_id
LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
order by table_name