2012-02-06 22 views
1

Select getdate()に相当する言語がMDX用であることを確認しようとしています。SQL Server 2008 R2 MDX GetDate()

私は単に問題のサーバーで日時を取得したいだけで、実際にはデータを照会しません。これは一種の煙草検査のためのものなので、私が作ることができる最も簡単な声明を理解する必要があります。彼らはすべて異なる構造を持っているので、私は実際にキューブを照会したくありません。私はちょうどサーバーに接続することによってサーバーレベルの情報を取得する必要があります(必ずしもデータではありません)。

ありがとうございました。

答えて

2

How To Obtain the Current Day with a MDX Query or Expression in SQL Server 2000 Analysis Servicesを引用:

答えは次のとおりです。

-- 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で実行する必要があります。

+0

+1 - これはSSAS 2000の後のバージョンを実行します – Lamak

+0

ありがとうございますが、すべてのキューブ名が異なるため、必ずしもキューブをクエリできないため、サーバーから何かメモリを取得する必要がありますTSQLのGetDate()関数をサンプルとして使用しました。ありがとう。 – Snowy

+1

[FROM]句よりも[MDX Select文](http://msdn.microsoft.com/en-us/library/ms146002(v = sql.90).aspx)に表示されます。私はあなたがこの句でサーバからデータを取得する方法を知らない。 [クエリの実行後にWITHキーワードを使用して作成された計算メンバーが存在しなくなりました](http://msdn.microsoft.com/en-us/library/ms187058(v=sql.90)) aspx) – danihp

関連する問題