Reputation:
I'm trying to create a new role on my analysis DB.
i have tested multiple combination :
when running a simple MDX query with Openrowset => it works.
when running the it works.
when trying to create anew SSAS role from SQl relational DB using openrowset=> ERROR.
here is the code I'm trying
SELECT * FROM OpenRowset('MSOLAP', 'DATA SOURCE=servername; Initial Catalog=AnalysisDBName;',
'
<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<ParentObject>
<DatabaseID>AnalysisDBName</DatabaseID>
</ParentObject>
<ObjectDefinition>
<Role xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2">
<ID>Role 22</ID>
<Name>Rolename</Name>
</Role>
</ObjectDefinition>
</Create>
')
and the error that i receive is:
OLE DB provider "MSOLAP" for linked server "(null)" returned message "A required child element is missing under Envelope/soap:Body at line , column (namespace 'http://schemas.xmlsoap.org/soap/envelope/'). One of Fault, AuthenticateResponse, DiscoverResponse, ExecuteResponse was expected.".
Msg 7321, Level 16, State 2, Line 2
An error occurred while preparing the query "
<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<ParentObject>
<DatabaseID>AnalysisDBName</DatabaseID>
</ParentObject>
<ObjectDefinition>
<Role xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2">
<ID>Role 22</ID>
<Name>Rolename</Name>
</Role>
</ObjectDefinition>
</Create>
" for execution against OLE DB provider "MSOLAP" for linked server "(null)".
Please help :)
Regards,
elie
Upvotes: 0
Views: 5249
Reputation:
You can add your ssas olap as linked server and then use this code:
EXEC ('XMLAsomething ....rest of your code') AT LinkedOlap
Upvotes: 1
Reputation: 432271
OPENROWSET expects a valid query such as "SELECT * FROM table
" (in the correct SQL dialect of the data source specified)
The xml snippet is not a valid query in most SQL dialects, especially not T-SQL.
Unfortunately, there is no CREATE USER equivalent in MDX like T-SQL, so it can't be done via regular SQL statement or OPENROWSET.
In the SSAS Granting User Access, it mentions using AMO to manage users which can't done using OPENROWSET.
Sorry, it's not an answer: I can only say how not to do it...
Upvotes: 0