locked
Multiple <Create>...</Create> in one file Problem RRS feed

  • Question

  • I'm trying to create multiple dimensions (almost 800) in an SSAS 2005 database through one XMLA script file in an XMLA Query window in Management Studio. I have generated the <Create>...</Create> commands and tested that a representative sample of them execute correctly individually. However, when I paste them all (or just 2 of them) into the query window one right after the other and attempt to run the file, I get an error that claims only one <Create> command can appear:

    "The 'Create' element at line 58, column 76 ('http://schemas.microsoft.com/analysisservices/2003/engine' namespace) appears more than once under Envelope/Body/Execute/Command."

    If I understand the documentation on the Create element correctly, you can have more than one such element within the <Command> </Command> element:

    "0-n: Optional element that can occur more than once."

    Anyone have an ideas on how to make this work? I'm trying to create 790+ dimensions, so I'd sure like to avoid executing each script manually.
    Tuesday, April 4, 2006 8:32 PM

Answers

  • i think something like the following should work:

    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
      <Body>
        <Execute xmlns="urn:schemas-microsoft-com:xml-analysis">
          <Command>
            <Batch xmlns="
    http://schemas.microsoft.com/analysisservices/2003/engine">
                 <Create>..1st create.. .</Create>
                 <Create>..2nd create...</Create>
            </Batch>
          </Command>
          <Properties>
            <PropertyList>... properties list if any .... </PropertyList>
          </Properties>
        </Execute>
      </Body>
    </Envelope>

    actually, SSMS can accept just the <batch> part itself i think (since it adds envelope/body .. etc. when needed).

    hope this helps,

    Tuesday, April 4, 2006 10:01 PM

All replies

  • hello Bob,

    i think you could use <Batch> and specify all your create elements underneath. Books Online describe Batch in more details.

    hope this helps,

    Tuesday, April 4, 2006 8:54 PM
  • Hi, Mary! Thanks for your response.

    I've actually tried <Batch><Create>...</Create><Create>...</Create></Batch> and it did not work. It complains that the Batch element may not occur within the <Command> element, although the documentation does say you can have <Batch> within <Command>.

    Other ideas?

    Bob

    Tuesday, April 4, 2006 8:58 PM
  • i think something like the following should work:

    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
      <Body>
        <Execute xmlns="urn:schemas-microsoft-com:xml-analysis">
          <Command>
            <Batch xmlns="
    http://schemas.microsoft.com/analysisservices/2003/engine">
                 <Create>..1st create.. .</Create>
                 <Create>..2nd create...</Create>
            </Batch>
          </Command>
          <Properties>
            <PropertyList>... properties list if any .... </PropertyList>
          </Properties>
        </Execute>
      </Body>
    </Envelope>

    actually, SSMS can accept just the <batch> part itself i think (since it adds envelope/body .. etc. when needed).

    hope this helps,

    Tuesday, April 4, 2006 10:01 PM
  • Aha! I had not included the xmlns namespace attribute. When I added the namespace attribute xmlns="http://schemas.microsoft.com/analysisservices/2003/engine",  it worked like a charm.

    Thanks, Mary!

    Tuesday, April 4, 2006 11:39 PM