SSAS: Running mulitple MDX Queries

This tip came up during a discussion amongst the Analysis Services Stored Procedure team and Chris Webb just posted about it too.

Apparently you can use the GO keyword to separate MDX batches in SSMS, in much the same way that you can with T-SQL batches


[Adventure Works]


SELECT [Measures].[Internet Sales Amount] ON 0,
[Date].[Day of Week].MEMBERS ON
FROM [Adventure Works]

This ability is built in to SSMS, “GO” is not a valid MDX keyword. It is SSMS that is breaking up the script and sending it as separate queries. Apparently the ability to execute multiple statements was explicitly omitted from MDX in order to prevent injection attacks. So even if you are building your query using string concatenation (which is often what you need to do) there is simply no way for a user to insert a semi-colon and break-up your query in order for them to execute a statement of their own, you simply get back the error that "Mulitple statements are not allowed".


Print | posted on Monday, August 14, 2006 8:20 PM