使用 MDX 查询列出维度成员

发布于 2024-11-14 20:00:41 字数 32 浏览 2 评论 0原文

有没有办法列出维度成员而不获取每个成员的默认度量?

Is there a way to list dimension members without fetching default Measure for each member?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

蓝礼 2024-11-21 20:00:41

您可以在相反的轴上选择任何内容:

SELECT
  { } on 0,
  { DESCENDANTS([Dimension].[Hierarchy]) } on 1
FROM [Cube]

选择空集会阻止 SSAS 在相反的轴上添加默认度量。

You could SELECT nothing on the opposite axis:

SELECT
  { } on 0,
  { DESCENDANTS([Dimension].[Hierarchy]) } on 1
FROM [Cube]

SELECTing an empty set prevents SSAS from adding the default measure on the opposite axis.

嗫嚅 2024-11-21 20:00:41

您可以访问 Magnus 提到的目录视图(顺便说一句记录在此处 ),从 SQL Server 2008 使用以下 SQL 语法而不是 MDX:

SELECT *
  FROM $system.MDSCHEMA_MEMBERS
 WHERE ...

Analysis Services 理解的 SQL 是有限的:没有可能的连接,并且 WHERE 条件可能只包含类似这样的子句[HIERARCHY_UNIQUE_NAME] = '[日期].[订单日期]' 通过 AND 连接。不支持 GROUP BY 和 ORDER BY。但尽管如此,您仍然可以查询多维数据集元数据。

根据您用于访问 Analysis Services 的接口,可能会出现一些问题,因为这些元数据以结果集格式返回,而不是以单元格格式返回。

You can access the catalog views which Magnus mentions (which by the way are documented here), from SQL Server 2008 using the following SQL syntax instead of MDX:

SELECT *
  FROM $system.MDSCHEMA_MEMBERS
 WHERE ...

The SQL understood by Analysis Services is limited: There are no joins possible, and the WHERE condition may only contain clauses like [HIERARCHY_UNIQUE_NAME] = '[Date].[Order Date]' connected via AND. GROUP BY and ORDER BY are not supported. But nevertheless, you can query the cube meta data.

Depending on the interface you are using to access Analysis Services there might be some issues, as these metadata are returned in resultset format, not in cellset format.

情未る 2024-11-21 20:00:41

我过去在没有数据的情况下查询的方式是:

WITH MEMBER Measures.Amount AS 0 
SELECT { 
   [-dimensionName-].[-hierachyName-].Members 
} ON COLUMNS 
FROM [-cubeName-]

但是在观看 SQL Profiler 中的 BIDS 工作之后,我了解了

SELECT { 
   [-dimensionName-].[-hierachyName-].Members 
} ON COLUMNS 
FROM [$-dimensionName-]

例如

SELECT { Organization.Organization.Members } ON COLUMNS FROM [$Organization]

不确定此路线是否有意想不到的副作用,但如果您只想将内容转储到层次结构而不担心数据,那么这是另一种选择。

The way I used to query without data was:

WITH MEMBER Measures.Amount AS 0 
SELECT { 
   [-dimensionName-].[-hierachyName-].Members 
} ON COLUMNS 
FROM [-cubeName-]

But after watching BIDS work in SQL Profiler I learned about

SELECT { 
   [-dimensionName-].[-hierachyName-].Members 
} ON COLUMNS 
FROM [$-dimensionName-]

e.g.

SELECT { Organization.Organization.Members } ON COLUMNS FROM [$Organization]

Not sure if there are unintended side-effects of this route but if you just want to dump the contents a hierarchy without worrying about data, it's another option.

坏尐絯 2024-11-21 20:00:41

您可以使用 ADOMD Catalog 对象来询问多维数据集,并找出它具有哪些度量/维度等。这根本不涉及 MDX。

You can use the ADOMD Catalog object to interrogate a cube, and find out what measures/dimensions it has etc. This does not involved MDX at all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文