1

我正在尝试确定Select getdate()MDX 的语言等价物。

我想简单地获取相关服务器的日期时间,而不是实际查询任何数据。这是一种冒烟测试,所以我需要理解我能做出的最简单的陈述。我不想实际查询任何多维数据集,因为它们都有不同的结构。我只需要通过连接到服务器(不一定是数据)来获取服务器级别的信息。

谢谢。

4

1 回答 1

2

引用如何在 SQL Server 2000 Analysis Services 中使用 MDX 查询或表达式获取当前日期

答案是:

-- The First Calculated member is the value of NOW()
WITH  MEMBER [Measures].[Full Date] as 'NOW()'
-- The Second Calculated Member is the Day part of the first calculated member.
MEMBER [Measures].[What Day] as 'DAY([Full Date])'
-- The Third Calculated Member is the Month part of the first calculated member.
MEMBER [Measures].[What Month] as 'MONTH([Full Date])'
-- The Fourth Calculated Member is the Year part of the first calculated member.
Member [Measures].[What Year] as 'YEAR([Full Date])'
SELECT
   {[Full Date],[What Day],[What Month],[What Year]} ON COLUMNS
FROM Sales

结果:

Full  Date   What Day        What Month     What Year
1:16:16 AM   19              9              2001

文章适用于 SASS 2000,但应与 2008 R2 一起运行。

于 2012-02-06T20:43:43.577 回答