title: Rename SQL Result file to Date format "MMDDYYYY" Automatically?
body: <p>I have the below SQL query which works for me very fine. however, I want to make my .csv file name as a date format "MMDDYYYY", which means whenever the job is executed on a daily basis it should automatically make the name of "Results.csv" to a current system date when the job was executed, how I can edit my code below to cater the same.</p>
  
  <pre><code>EXEC msdb.dbo.sp_send_dbmail @profile_name='default',
  @recipients='dev@null.com',
  @subject='test mail',
  @query= 'SELECT * from testtable',
  @attach_query_result_as_file=1,
  @query_attachment_filename = 'Results.csv',
  @query_result_separator = ','
  </code></pre>