前面有写过《MS SQL为字段添加说明》https://www.cnblogs.com/insus/p/12106589.html
现如今,我们获取这些字段的描述值。
先来看一句SELECT语句:
SELECT * FROM sys.extended_properties GO
如上SQL语句,虽然得到描述的值,但我们不清楚是哪一张表,和哪一个字段的说明。
因此,得使用系统另外对象来关联查询:
SELECT t.[name] AS [Table_Name],c.[name] AS [Column_Name],e.[value] AS [Column_Description] FROM sys.tables t INNER JOIN sys.columns c ON(t.[object_id] = c.[object_id]) LEFT JOIN sys.extended_properties e ON (t.[object_id] = e.[major_id] AND c.[column_id] = e.[minor_id] AND e.[name] = 'MS_Description') GO