我正在尝试使用DMV从表格多维数据集查询元数据。我能够在没有where子句的情况下使它工作,但是似乎无法使where子句起作用。有什么建议吗?
这是有效的代码:
SELECT
[MEASURE_CAPTION] AS [Measure]
,[MEASURE_IS_VISIBLE] AS [Visable]
,[DESCRIPTION] AS [Description]
,[MEASURE_DISPLAY_FOLDER] AS [Display Folder]
,[EXPRESSION] AS [Calculation]
FROM $SYSTEM.MDSCHEMA_MEASURES
我尝试过的WHERE子句是:
WHERE ([MEASURE_IS_VISIBLE].[members].[true])
我收到以下错误:
The dot expression is not allowed in the context at line 9, column 1.
也:
WHERE [MEASURE_IS_VISIBLE] = TRUE
我收到以下错误:
Error: A Boolean expression is not allowed in the context at line 9, column 7.
我已经尝试过对这些主题进行许多验证,但总是得到相同的结果。我完全不了解MDX的工作原理,因此将不胜感激。
答案 0 :(得分:3)
MEASURE_IS_VISIBLE
是一个布尔列,因此必须进行过滤。以下查询将结果过滤为仅MEASURE_IS_VISIBLE
值为true的结果。对于错误的行,将其更改为WHERE NOT MEASURE_IS_VISIBLE
。您可以从文档here中查看此DMV的数据类型。
SELECT
[MEASURE_CAPTION] AS [Measure]
,[MEASURE_IS_VISIBLE] AS [Visable]
,[DESCRIPTION] AS [Description]
,[MEASURE_DISPLAY_FOLDER] AS [Display Folder]
,[EXPRESSION] AS [Calculation]
FROM $SYSTEM.MDSCHEMA_MEASURES
WHERE MEASURE_IS_VISIBLE