|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, June 01, 2009 12:11 PM
Points: 23,
Visits: 49
|
|
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.
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Monday, June 29, 2009 9:06 AM
Points: 283,
Visits: 360
|
|
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
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Thursday, July 02, 2009 11:29 AM
Points: 316,
Visits: 569
|
|
| 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.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Thursday, June 25, 2009 2:14 PM
Points: 20,
Visits: 114
|
|
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
|
|
|
|