November 11, 2008 at 9:05 am
I have a SELECT statement that I need to run on a weekly basis. I need the results to be put in CSV/XLS format and to be emailed automatically. Is there anyway to do this via a job?
Any help on this would be greatly appreciated.
Thanks,
Damon Jongbloed
Jennie-O Turkey Store, Inc.
November 13, 2008 at 10:18 am
There is but it's not a recommended approach as you need xp_cmdshell switched on etc. Also do you have Database mail activated? The best way is via SSIS, but you could also try the following;
http://www.sqlservercentral.com/Forums/Topic487837-19-1.aspx#bm492666
November 13, 2008 at 2:16 pm
Use sp_send_dbmail. You can specify a query parameter to be attached as a file. You can also specify a header and a delimiter. So setup a query and specify comma as the delim with a header (or not). Name the file .csv and bingo you should have what you need.
November 13, 2008 at 2:25 pm
Use OLE DB Source ( and put ur select statement in there) then have an excel destination . Then in the control flow- have a send mail task that follows the above “data flow task” and send the excel file as an attachment and finally schedule it to run using sql agent
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply