Every day i send report excel file to my client .so i create job to send mail using "SP_SEND_DBMAIL",Its working properly but.i can't set autofit colums in excel
use msdb
go
DECLARE @SUB VARCHAR(100)
SET @SUB = (SELECT 'Daily Sales Report on '+ replace(convert(NVARCHAR, getdate(), 106), ' ', '/'))
EXEC sp_send_dbmail @profile_name='test Profile',
@body='Attachment File Sent',
@query=select * from tr_sales_mas,
@query_attachment_filename='test.csv',
@attach_query_result_as_file=1,
@exclude_query_output=1,
@query_result_separator=' ',@query_result_width =32767,
@query_result_no_padding=1,
@query_result_header =1
go
how to set auto fit to excel columns