sqlserver 查询数据库的表说明和表字段说明

查询数据库表说明:
select top 1000
  ROW_NUMBER() OVER (ORDER BY a.object_id) AS No, a.name AS 表名,  isnull(g.[value],'-') AS 说明
from sys.tables a left join sys.extended_properties g  on (a.object_id = g.major_id AND g.minor_id = 0)

 

查询表字段说明:

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 ='表名称'

 

 

你可能感兴趣的:(sqlserver数据库)