title: Update SQL Server table with XML
body: <p>I have an XML variable that looks like this:</p>
  
  <pre><code>&lt;code&gt;
  &lt;IDs&gt;
      &lt;ID id="1"&gt;a&lt;/ID&gt;
      &lt;ID id="43"&gt;d&lt;/ID&gt;
      &lt;ID id="3"&gt;b&lt;/ID&gt;
  
  &lt;/IDs&gt;
  &lt;/code&gt;
  </code></pre>
  
  <p>I want to use that in a stored procedure (SQL Server) that will update a table.  </p>
  
  <p>My table look like this:</p>
  
  <pre><code>ID INT,
  a INT,
  b INT,
  c INT,
  d INT
  </code></pre>
  
  <p>The statement should increase the letter value associated with the id.</p>
  
  <p>SO it would look like this:</p>
  
  <pre><code>Table Row with ID = 1, update column "a" by increasing the current value by 1.
  Table Row with ID = 43 - update column "d" by increasing current value by 1.
  Finally Table row with ID= 3 - update column "b" by increasing value by 1.
  </code></pre>
  
  <p>This is what I have so far - (The second line is where i need the most help.):</p>
  
  <pre><code>Update MyTable
  SET @letter = letterVal +1
  WHERE ID IN(
  SELECT x.v.value('@id','INT')
  FROM @xmlIDs.nodes('/IDs/ID') x(v)
  )
  </code></pre>