Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 MDX Syntax

Author  Topic 

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2007-09-30 : 15:00:33
Does anyone know if the following problem has been fixed?

The following will return zero records because there is no space before "2005":

select
{[measures].[dollar sales], [measures].[unit sales]}
on columns,
{[time].[q1,2005], [time].[q2,2005]}
on rows
from [sales]
where ([customer].[ma])

It doesn't throw an error! It just executes and returns zero results! That's really bad!

Put a space in for one and you'll only get that quarter returned:

{[time].[q1,2005], [time].[q2, 2005]}

put a space in for both, and you'll get both:

{[time].[q1, 2005], [time].[q2, 2005]}

Does anyone know if this has been fixed? I view this as a terrible bug. I've been thinking the database wasn't populated when it clearly was. Surely the parser should through an error if it doesn't like your syntax! And it shouldn't force me to use spaces where it isn't required. I'm in the Henderson school of "the less spaces the better".

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2007-10-11 : 11:21:22
Answer from George Spofford:

It's not a bug, it's by design, and as a behavior it can be turned off. Comes down to a question of expectations. In SQL, if you query for records WHERE TKEY IN ('q1,2005', 'q2,2005') and the records only have values of 'q1, 2005', 'q2, 2005', etc, you'll get back no rows instead of an error.

I've found a number of cases where this is preferred behavior, though not always. If you've got MDX queries or fragments stored somewhere that include enumerated members, and a member gets removed, then the end user gets presented with an error message instead of a result that was the best which could be obtained.

Unfortunately, the behavior is a connection setting (MDX Missing Member Mode), and not something that's part of the language. The correctness of this behavior might be different for different parts of a query, for example. But, it's better than nothing.

Go to Top of Page
   

- Advertisement -