title: SQL Email Tabular Format giving Scientific Values instead of fixed decimals
body: <p>I have a query that sends the results to my email in a tabular format. I am using this link as a reference. <a href="https://www.mssqltips.com/sqlservertip/2347/send-email-in-a-tabular-format-using-sql-server-database-mail/" rel="nofollow noreferrer">https://www.mssqltips.com/sqlservertip/2347/send-email-in-a-tabular-format-using-sql-server-database-mail/</a> </p>
  
  <p>I am able to successfully send the email with the data I want, but the values are not the way I want it. </p>
  
  <p><a href="https://i.stack.imgur.com/skxwM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/skxwM.png" alt="enter image description here"></a></p>
  
  <p>When I run the query with out using HTML I get the right formatted values.</p>
  
  <p><a href="https://i.stack.imgur.com/yW6wN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yW6wN.png" alt="enter image description here"></a></p>
  
  <p>What do I need to do in the script that will get me the fixed values and not the scientific notation when implementing a html tabular format?  Any help is most appreciated. </p>
  
  <pre><code>DROP TABLE #timetot 
  
  DECLARE @intVar INT 
  
  SET @intVar=0; 
  
  ; 
  WITH ss 
       AS (SELECT a.rowid, 
                  a.employee, 
                  Sum(b.value) AS Total 
           FROM   employeetimesheets b 
                  RIGHT JOIN employees a 
                          ON a.rowid = b.empid 
           WHERE  b.day &gt;= Dateadd("d", -6, '2015-10-10') 
                  AND b.day &lt;= Dateadd("d", -0, '2015-10-10') 
           GROUP  BY a.rowid, 
                     a.employee 
           UNION ALL 
           SELECT rowid, 
                  employee, 
                  @intVar AS Total 
           FROM   employees 
           EXCEPT 
           SELECT empid, 
                  employee, 
                  @intVar AS Total 
           FROM   employeetimesheets a 
                  INNER JOIN employees b 
                          ON a.empid = b.rowid 
           WHERE  a.day &gt;= Dateadd("d", -6, '2015-10-10') 
                  AND a.day &lt;= Dateadd("d", -0, '2015-10-10')) 
  SELECT * 
  INTO   #timetot 
  FROM   ss 
  
  DECLARE @xml NVARCHAR(max) 
  DECLARE @body NVARCHAR(max) 
  
  SET @xml = Cast((SELECT [rowid]    AS 'td', 
                          '', 
                          [employee] AS 'td', 
                          '', 
                          [total]    AS 'td', 
                          '' 
                   FROM   #timetot 
                   ORDER  BY rowid 
                   FOR xml path('tr'), elements) AS NVARCHAR(max)) 
  SET @body ='&lt;html&gt;&lt;body&gt;&lt;H3&gt;Employees with Un-finished or Null Timesheets&lt;/H3&gt; &lt;table border = 1&gt;  &lt;tr&gt; &lt;th&gt; RowId &lt;/th&gt; &lt;th&gt; Employee &lt;/th&gt; &lt;th&gt; Total &lt;/th&gt; &lt;/tr&gt;' 
  SET @body = @body + @xml + '&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;' 
  
  EXEC msdb.dbo.Sp_send_dbmail 
    @profile_name = '***', 
    @body = @body, 
    @body_format ='HTML', 
    @recipients = '****.com', 
    @subject = 'E-mail in Tabular Format'; 
  </code></pre>