Paul Mauriello
asked on
How do I make an MDX Query, run from inside a stored procedure, using OPENROWSET, dynamic?
Using SQL Server 2014 and I'm trying to merge Analytic data and Relational data for a report. I'm almost there but there are parts that need to be dynamic in the MDX part.
See attached query. I need the DATASOURCE dynamic, the Initial Catalog dynamic, and the year currently hardcoded as 2017 dynamic. I try to replace them with variables and it keeps giving me errors.
SQLMDXQuery.txt
See attached query. I need the DATASOURCE dynamic, the Initial Catalog dynamic, and the year currently hardcoded as 2017 dynamic. I try to replace them with variables and it keeps giving me errors.
SQLMDXQuery.txt
ASKER
I tried that and got errors
Msg 156, Level 15, State 1, Line 46
Incorrect syntax near the keyword 'SELECT'.
Msg 102, Level 15, State 1, Line 46
Incorrect syntax near '{'.
Msg 102, Level 15, State 1, Line 52
Incorrect syntax near 'Date'.
Msg 102, Level 15, State 1, Line 54
Incorrect syntax near 'Voyage'.
Msg 156, Level 15, State 1, Line 46
Incorrect syntax near the keyword 'SELECT'.
Msg 102, Level 15, State 1, Line 46
Incorrect syntax near '{'.
Msg 102, Level 15, State 1, Line 52
Incorrect syntax near 'Date'.
Msg 102, Level 15, State 1, Line 54
Incorrect syntax near 'Voyage'.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you that worked awesomely
welcome. Glad to help as always. :)
Open in new window