January 12, 2012 at 3:23 pm
I have a sql job that uses a query to fetch results and then email the results in a text file.
Now I have to email the same results as an excel.
Can someone advice me how can I do that?
Thanks
January 12, 2012 at 3:28 pm
Just change the file extension to .xls and tab as value for @query_result_separator
January 27, 2012 at 5:07 am
Be very careful sending excel files through the mail. They tend to be too large for most people to send or receive.
You can either zip the file and send the zip via dbmail or you can FTP the Excel file.
Also, be leery of sending an unencrypted file via dbmail, especially if you're sending it "out of house." Privacy laws can be a royal *itch and can get you fired if someone who's not supposed to get that data ends up intercepting or receiving it.
Lastly, from experience, changing the extension does not always work -- when changing just an existing file extension. (EDIT: Though Lutz's suggestion is a good one). You may have to use an SSIS package to load an excel file destination, instead of your text file, if this is a frequent event. If it's a one-off thing, consider importing the text file into excel and save it to the destination you intend to get it with dbmail.
Does that help?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply