Search code examples
ssisssasssmsssas-2012

Trying to run MDSCHEMA_SETS but getting a failure


I am trying to run this command either through SSIS (execute ddl) or a SSMS Job step using the Analysis Services Command. It works fine through management studio xmla query window though.

<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
    <RequestType>MDSCHEMA_SETS</RequestType>
    <Restrictions />
    <Properties />
</Discover>

I get the following error:

Microsoft.AnalysisServices.Xmla.XmlaException: The Discover element at line 7, column 72 (namespace urn:schemas-microsoft-com:xml-analysis) cannot appear under Envelope/Body/Execute/Command.


Solution

  • This appears to work through an SSIS Script task.

    string servername = Dts.Variables["$Project::SSAS_QueryServerName"].Value.ToString();
    XmlaClient clnt = new XmlaClient();
    clnt.Connect(servername);
    string xmla = "<Discover xmlns=\"urn:schemas-microsoft-com:xml-analysis\"> \r\n" +
    @"<RequestType>MDSCHEMA_SETS</RequestType>
    <Restrictions />
    <Properties />
    </Discover>";
    clnt.Send( xmla, null );
    clnt.Disconnect();