title: how do I convert a select statement result into an HTML table in SQL Server?
body: <p>I have a table:</p>
  
  <pre><code>Select A, B, C 
  FROM Table
  WHERE Z = P 
  AND Y = N
  </code></pre>
  
  <p>I want to capture the results and create an HTML table out of it, as such:</p>
  
  <pre><code>DECLARE @HTMLTable VARCHAR(MAX)
  
  @HTMLTable = ???
  
  A   B   C
  xx  xxx xxxxx
  x   xx  x
  xx  x   xxx
  </code></pre>
  
  <p>And so on.</p>
  
  <p>The reason for this is because I want to send this HTML table in an email.</p>
  
  <p>How do I go about doing this?</p>