获取SQL Server中表的描述信息
本文关键字:描述 信息 SQL Server 获取 | 更新日期: 2023-09-27 18:04:57
我只想得到表的MS_Description
现在我只对列设置:
select
sc.name,
sep.value [Description]
from sys.tables st
inner join sys.columns sc on st.object_id = sc.object_id
left join sys.extended_properties sep on st.object_id = sep.major_id
and sc.column_id = sep.minor_id
and sep.name = 'MS_Description'
where st.name =@TableName
我也有@TableName作为参数由于
试试这个-基本上使用minor_id = 0
来获取表的描述(不包括任何列):
SELECT
t.Name,
sep.*
FROM
sys.tables t
INNER JOIN
sys.extended_properties sep ON t.object_id = sep.major_id
where
sep.Name = 'MS_Description'
AND sep.minor_id = 0 -- not any column - but the table's description