SQL server下所有表名及字段名及注释查询
--查询所有表及注释
SELECT
A.name ,C.value
FROM sys.tables A
LEFT JOIN sys.extended_properties C ON C.major_id = A.object_id
WHERE C.minor_id=0
group by A.name ,C.value
----查询表字段注释
SELECT
A.name AS table_name,
B.name AS column_name,
C.value AS column_description
FROM sys.tables A
INNER JOIN sys.columns B ON B.object_id = A.object_id
LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
WHERE A.name = 'TABLE'