我知道这个问题已在其他地方得到解决,但我无法弄明白。
我有这个观点:
SELECT t.name AS 'TableName'
,c.name AS 'ColumnName'
,SEP.VALUE as 'DETAILS'
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
left join sys.extended_properties sep on t.object_id = sep.major_id
and c.column_id = sep.minor_id
and sep.name = 'MS_Description'
当我运行此查询时,我得到了预期的结果:
SELECT * FROM [VIEW] WHERE DETAILS IS NOT NULL
但是,有一个描述我通过表设计器添加到其中一个列中,后来我将其删除。我的问题是这行仍然返回我的查询,DETAILS显示为空字符串。我希望这一行不再出现,所以我跑了:
UPDATE sys.extended_properties SET VALUE=null WHERE major_id=1781581385 AND minor_id=4
我收到以下错误:
Msg 259, Level 16, State 1, Line 12
Ad hoc updates to system catalogs are not allowed.
我已尝试将数据库设置为单个用户,如Martin1所示: https://ask.sqlservercentral.com/questions/40909/ad-hoc-update-to-system-catalogs-is-not-supported.html
我觉得我错过了一些简单的东西,并希望得到任何反馈。我再次为重复的帖子道歉。