June 12, 2009 at 2:38 am
Hi All
I use DBMail to attach a Excel file from a SQL, but the problem is that when you open the excel file that columns are not sorted, i have to use convert text columns option in excel to have the output in columns, is there any way that i can export the result in a proper aligned Excel sheet.
The code i used is as below
EXECUTE msdb.dbo.sp_send_dbmail
@profile_name = 'ABC',
@recipients = 'Test@Test.com',
@Query='select * from Table1',
@subject ='Test Maill',
@attach_query_result_as_file = 1,
@query_result_separator = '|',
@query_result_no_padding = 1,
@query_result_header =1,
@query_attachment_filename = 'TestExcel.xls',
@Body ='Follow Instructions to Load into Excel'
June 12, 2009 at 7:53 am
Maybe this explanation will help: http://www.mssqltips.com/tip.asp?tip=1202
Greetz,
Hans Brouwer
June 12, 2009 at 9:11 am
Thanks mate, but there is one main problem, i am using a 64 bit version of SQL 2005, which is not allowing me to use OLEDB, is there any other way that i can do this 🙁
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply