|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, February 14, 2013 11:25 PM
Points: 3,
Visits: 15
|
|
@subject ='Status Log for Today' ,@profile_name ='Status' ,@query ='my query'
,@attach_query_result_as_file = 1 ,@query_attachment_filename ='Status.csv'
output has Column name called COUNTRY contain different countries AU,MY,SG
I want to group by country and attach the result in different sheet in same excel file
Example: If AU means all AU data in one sheet and SG means all SG data in another sheet
Is it possible?
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 9:55 PM
Points: 6,720,
Visits: 11,759
|
|
sandosh.star (2/12/2013) @subject ='Status Log for Today' ,@profile_name ='Status' ,@query ='my query'
,@attach_query_result_as_file = 1 ,@query_attachment_filename ='Status.csv'
output has Column name called COUNTRY contain different countries AU,MY,SG
I want to group by country and attach the result in different sheet in same excel file
Example: If AU means all AU data in one sheet and SG means all SG data in another sheet
Is it possible? No, for multiple reasons. 1) a CSV file and an Excel file are two different things. While a file with a .csv extension may open in Excel by default because of a Windows setting on somone's workstation it does not make that file an Excel-formatted file. A CSV file is merely a special form of a plain-text file and cannot have "Tabs". 2) msdb.dbo.sp_send_dbmail cannot generate Excel files. It can generate text files with whatever name, extension and delimiter you like, but not Excel-formatted files. 3) msdb.dbo.sp_send_dbmail can only execute one query and push all the results from that query into a text file.
If you must generate an Excel-formatted file by issuing multiple queries and pushing each result into a separate Worksheet within an Excel Workbook then you could look into using SSIS.
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|