Request for help : Mailing query results with xl in correct format
Hi, We have a requirement in our project to schedule a sql job for sending query results in xl. I have the below code and, but the xl is not formatted state Could you please help me for sending the same in xl with corrected format. Thanks, Khaja Shaik. Query: EXEC SEGOTN12487.msdb.dbo.sp_send_dbmail @profile_name = 'OM_SQL_Profile', @recipients = 'mailid', @query = 'Select * from logging.EventLog where LogType =1 and Timestamp >= CONVERT(VARCHAR(10), GETDATE(), 112) and Message not like ''%Stopping the MQ%''', @subject = 'Work Order Count', @attach_query_result_as_file = 'true', @execute_query_database='om_test_r1', @query_attachment_filename= 'Test.xls'