Hi,
Need your advice. I use this stored procedure (msdb.dbo.sp_send_dbmail) to send mail. Problem here all my result excel in 1st colum.
Here is my code :
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'CIADatabaseMail',
@recipients = @to,
@subject = @subject,
@body = @body,
@query = 'set nocount on select top 10 * from marsx.dbo.enduser',
@attach_query_result_as_file = 1,
@query_attachment_filename = 'sample.xls',
@query_result_separator = ' ',
@query_result_width = 1500,
@query_result_header = 0,
@query_result_no_padding = 1
I also change the @query_result_separator to TAB,space or comma. But the result is still the same.