title: T-SQL send mail with excel attachment
body: <p>I want create a SP with T-SQL,
  I've 3 SELECT like this </p>
  
  <pre><code>SELECT a, b FROM TableA
  SELECT c, d, e FROM TableB GROUP BY c, d 
  SELECT sum(f) FROM TableC
  </code></pre>
  
  <p>Then i've 3 query results,
  I want to send them by mail with excel attachment 
  I've find something to send a attachment but only one and with a files already created, i don't want store it in my HDD, just send it !</p>
  
  <pre><code>-- Send the e-mail with the query results in attach
  exec msdb.dbo.sp_send_dbmail @recipients="Your email",
  @query=@qry,
  @subject='Client list',
  @attach_query_result_as_file = 1,
  @query_attachment_filename = 'result.csv',
  @query_result_separator=',',@query_result_width =32767,
  @query_result_no_padding=1
  </code></pre>
  
  <p>Thanks :)</p>