Sonali Avhad

Sonali Avhad

  • NA
  • 234
  • 42.2k

send email with attachment using sql but excel has first row as -----

Feb 2 2021 11:53 AM
I used following code
exec msdb.dbo.sp_send_dbmail
@profile_name='ProfileName',
@body='Hello.',
@recipients='RecipientEmail',
@subject='Testing Email ',
@attach_query_result_as_file=1,
@query = @sqlQuery,
@query_attachment_filename='File.xls',
@query_result_separator=@tab,
@query_result_no_padding=1,
@query_result_header = 1,
@query_result_width = 32767
 
The email is sent with excel file.But Excel file has first row as ----- value in each column.
Please help me. 
 

Answers (2)