I'm adding code to a SQL Server procedure that takes a string input, parses it into an mdx query, executes the query and returns the results.
I have created a function that parses the dates and measures in a way the procedure previously could not. I can add this code to the procedure and create the procedure just fine, but when I try to call the procedure I get a message that the query was completed but,
Neither the CommandText property nor the CommandStream property is set.
Most of what I can find on this error doesn't seem to point to a clue. Below is the procedure call that is used to generate results. Below that is the code that has been added to to the pre-existing procedure. The function [mdx].[mdxFiscalYearReturn_v2] is new and has been tested. I don't think the issue is with this object. Also, the procedure still returns correct results for queries that do not hit this function.
EXEC AnalysisServices.mdx.ExecOlapQuery_RCM_fy
@Cube='claim',
@Database='Provider Insights',
@Column='Claim Charge Amount;Date - Batch Submission Fiscal Year',
@Slicer='Date - Batch Submission Date Key=20210607-20230222;Office ID=9',
@Suppress=3;
If right(@origColumn,11) = 'Fiscal Year'
Begin
Select @Column = (SELECT [mdx].[ufnMdxParser] (@origColumn,'Axis',@database,@cube)),
@Slicer = (SELECT [mdx].[ufnMdxParser_RCM] (@origSlicer,'Slicer',@database,@cube))
Select @mdx =(Select [mdx].[mdxFiscalYearReturn_v2](@column,@slicer,@cube))
End
I think the issue is coming from not properly setting one or more of the variables in
DECLARE @Results NVARCHAR(MAX)
EXEC mdx.ExecuteMdxQuery @Database, @MDX, @Output, @Results OUTPUT,@TopN,@AllOthers,@Total,@TopNType,@OrderBy,@TotalVis,@Hide,@Search,@Instance,@alias;
Given the error message, where should I start looking?