title: How can I change the color of a specific cell in a table using html in SQL server 2012?
body: <p>I am using html code in my SQL Script to output results from a table in an email, but I need to change the color of the text if any of the results come back as specific string. Here is a snippet of what I'm using to produce the table:</p>
  
  <pre><code>'&lt;table border="2"&gt;' + 
                        '&lt;tr&gt;
                            &lt;th&gt;No#&lt;/th&gt;
                            &lt;th&gt;SERVER NAME&lt;/th&gt; 
                            &lt;th&gt;SERVER IP&lt;/th&gt;
                            &lt;th&gt;STATUS &lt;/th&gt;
                        &lt;/tr&gt;' +
                        CAST (( SELECT DISTINCT
                                 td = [NUMBER],                              '',
                                 td = [SERVER NAME],                         '',
                                 td = [SERVER IP],                           '',
                                 td = [STATUS],                   ''
                            FROM SUMMARY
                        FOR XML PATH('tr'), TYPE 
                            ) AS VARCHAR(MAX) ) +
  '&lt;/table&gt;';
  </code></pre>
  
  <p>So I am concerned about the "STATUS" Field, if it comes back SUCCESS it could stay as regular text, if it says BAD then I want it to be Red.... I have tried putting in the      <code>&lt;font color=""&gt;</code> tag but it only changes the Headers (between the TH tags)..</p>
  
  <pre><code>No# SERVER NAME SERVER IP   STATUS  
  1   SERVER1     10.10.10.1  BAD         --this should be red
  2   SERVER2     10.10.10.2  SUCCESS 
  3   SERVER3     10.10.10.3  BAD         --this should be red
  4   SERVER4     10.10.10.4  SUCCESS 
  </code></pre>