Hi all,
EXEC msdb.dbo.sp_send_dbmail
@recipients='sg@domainname.com',
@body='Message Body',
@subject ='Message Subject',
@profile_name ='test',
@query ='select top 10 * from [databasename].dbo.cst ',
@attach_query_result_as_file = 1,
@query_attachment_filename ='Results.csv'
This query is working.
But the datas in the Result file, which i getting in mail is not properly organised.and scrated.What i need to do to get the mail attachment file in correct formatas look likes in sql query result??
Any help would be highly appreciated.Thanks in advance..
EXEC msdb.dbo.sp_send_dbmail
@recipients='sg@domainname.com',
@body='Message Body',
@subject ='Message Subject',
@profile_name ='test',
@query ='select top 10 * from [databasename].dbo.cst ',
@attach_query_result_as_file = 1,
@query_attachment_filename ='Results.csv'
This query is working.
But the datas in the Result file, which i getting in mail is not properly organised.and scrated.What i need to do to get the mail attachment file in correct formatas look likes in sql query result??
Any help would be highly appreciated.Thanks in advance..