I have an issue with OPENQUERY and MDX, specifically, when a MDX query does not return any result set due to there being no data in that slice.
SELECT * FROM OPENQUERY(OLAPLinkedServer, ' WITH Measures..blah..blah SELECT NONEMPTY(blah) FROM blah....') as mdxqry
The problem I have is I get this error message:
Msg 7357, Level 16, State 2, Line 3
Cannot process the object "WITH....
Now, I have seen suggestions to use FMTONLY OFF and NOCOUNT ON. This is great and will work with T-SQL (as long as you treat it gently), but as far as MDX goes, this simply gives a syntax error.
Now, I can take off the NONEMPTY() and I get results back, but this is not what I want to do as really don't want to see the empty sets.
Oh, and the reason I have to do the MDX this was is because we are using CF as a front end and it will not connect directly to MSOLAP, so please don't suggest it, I have already had weeks of pain with that one.
Also, the MDX is built dynamically, but this is not the issue as can take the end result and it runs fine in the MDX query window.