title: SQL XML select multiple attributes
body: <p>i just need your help.
  I was looking for a solution, but nothing works yet.</p>
  
  <p>I have to select multiple attributes from the xml-file which is stored in a column of my table. </p>
  
  <p>This is the File:</p>
  
  <pre><code>&lt;ManagerConfig&gt;
     &lt;AccountList&gt;
       &lt;Account accountID=“1“  friendlyName=“Testname1“&gt; Test &lt;/Account&gt;
       &lt;Account accountID=“2“  friendlyName=“Testname2“&gt; Test &lt;/Account&gt;
       &lt;Account accountID=“3“  friendlyName=“Testname3“&gt; Test &lt;/Account&gt;
       &lt;Account accountID=“4“  friendlyName=“Testname4“&gt; Test &lt;/Account&gt;
     &lt;/AccountList
  &lt;/ManagerConfig&gt;
  </code></pre>
  
  <p>For this I´m using the following statement:</p>
  
  <pre><code>set @accountID = @xmlxx.value('(/ManagerConfig/AccountList/Account/@accountId)[1]', 'varchar(max)')
  set @friendlyName = @xmlxx.value('(/ManagerConfig/AccountList/Account/@friendlyName)[1]', 'varchar(max)')
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>accountID     friendlyname
  1             Testname1
  </code></pre>
  
  <p>When im changing the value from [1] to [2] im getting the second attribute. So thats no problem. But i need all of these attributes and export them into another temporary table.
  I thought i can replace the value with a variable [@i]: </p>
  
  <pre><code>set @accountID = @xmlxx.value('(/(ManagerConfig/AccountList/Account/@accountId)'[@i]'', 'varchar(max)')
  </code></pre>
  
  <p>But there is a syntax error: </p>
  
  <blockquote>
    <p>An insufficient number of arguments were supplied for the procedure or
    function value.</p>
  </blockquote>
  
  <p>I hope you can help me to find a solution..</p>
  
  <p>Greetz
  Dennis</p>