我的查询在SSAS上运行正常。
SELECT DIMENSION_NAME
FROM $SYSTEM.MDSCHEMA_DIMENSIONS
WHERE LEFT(CUBE_NAME,1) = '$'
AND [DIMENSION_UNIQUE_NAME] <> '[Metrics]'
AND [DIMENSION_UNIQUE_NAME] <> '[Measures]'
ORDER BY DIMENSION_NAME
如何指定NOT LIKE
条件以使所有Dimension Names
不以&#34; Fact
&#34;开头?在T-SQL中,它是用
AND [DIMENSION_UNIQUE_NAME] NOT LIKE 'Fact%'
但如何在MDX中编写它?
根据评论进行编辑:
如何编写查询,以便我可以过滤出以&#34; Fact
&#34;开头的元素。在名字?
以下查询返回错误:
SELECT DIMENSION_NAME ,*
FROM $SYSTEM.MDSCHEMA_DIMENSIONS
WHERE LEFT(CUBE_NAME,1) = '$'
AND [DIMENSION_UNIQUE_NAME] <> '[Metrics]'
AND [DIMENSION_UNIQUE_NAME] <> '[Measures]'
AND [DIMENSION_UNIQUE_NAME] NOT LIKE 'Fact%'
ORDER BY DIMENSION_NAME
-
Executing the query ...
Query (6, 29) The syntax for 'NOT' is incorrect.
Execution complete
答案 0 :(得分:1)
将第二行替换为:
AND LEFT([DIMENSION_UNIQUE_NAME], 4) <> 'Fact'
希望您在DMX
SSMS
查询窗口中运行该语句