title: Select multiple values from XML in SQL Server
body: <p>I have a <code>@MyXMLString</code> parameter being passed to a stored procedure in the following format:</p>
  
  <pre><code>DECLARE @MyXMLString XML
  SET @MyXMLString =
  '&lt;data formID="2"&gt;
   &lt;UnAssigned AcctTypeID="1"/&gt;&lt;UnAssigned AcctTypeID="2"/&gt;
   &lt;/data&gt;'
  </code></pre>
  
  <p>In the stored procedure, I have to retrieve the value of <code>formID</code> and <code>AcctTypeID</code> and then update a table.</p>
  
  <p>Now there will be only one <code>formID</code>, which I am able to retrieve</p>
  
  <pre><code>DECLARE @formID int
  SET @formID = @MyXMLString.value('(data/@formID)[1]','int')
  </code></pre>
  
  <p>But there can be one or multiple <code>AcctTypeID</code>, i.e. one or more of <code>'&lt;UnAssigned AcctTypeID="1"/&gt;'</code>. I need help in figuring out how to retrieve it. </p>