title: COALESCE STRING IN sql STATEMENT
body: <p>I have a COALESCE statement extracting data from a table:</p>
  
  <pre><code>DECLARE @Output NVARCHAR(MAX)
  
  SELECT @Output = COALESCE(@Output + ', ', '') +  '''' + tCCGroup + '''' 
  FROM tblActivityPerPPCC_Matrix
  WHERE tPPCC = 'NSEA0101'
  
  SELECT @Output OUTPUT
  </code></pre>
  
  <p>with the following output.</p>
  
  <pre><code>'FADT', 'FD10RB', 'WA600'
  </code></pre>
  
  <p>I want to insert this output string (which is now in the variable @Output) into the following statement:</p>
  
  <pre><code>SELECT * FROM XYZ
  WHERE Column_Name IN (&lt;&lt; THE OUTPUT FROM COALESCE &gt;&gt;)
  </code></pre>
  
  <p>to be similar as</p>
  
  <pre><code>SELECT * FROM XYZ
  WHERE Column_Name IN ('FADT', 'FD10RB', 'WA600')
  </code></pre>
  
  <p>This statement will be turned into a dynamic statement in a Cursor</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Pierre</p>