title: Using UNION ALL in STUFF / XML Path
body: <p>Msg 1086, Level 15, State 1, Line 20
  The FOR XML clause is invalid in views, inline functions, derived tables, and subqueries when they contain a set operator. To work around, wrap the SELECT containing a set operator using derived table syntax and apply FOR XML on top of it.</p>
  
  <p>I get this error when i run this:</p>
  
  <pre><code>SELECT
      STUFF((
      SELECT 1
      UNION ALL
      SELECT 2
      FOR XML PATH('')
      ),1,0,'') [COLUMN]
  </code></pre>
  
  <p>works fine when i run this (without Union ALL)</p>
  
  <pre><code>SELECT
      STUFF((
      SELECT 1
      FOR XML PATH('')
      ),1,0,'') [COLUMN]
  </code></pre>
  
  <p>Any suggestions why UNION ALL Doesn't work, or how to get it to work inside the <code>STUFF()</code>?</p>