Re: Export Query To Excel
Who would run the query? Excel can't, SQL Server can't, Access might come pretty close, and .NET can....with a few steps along the way. I have a class over in the .NET CodeBank that I wrote to export datatables and datareaders. That might not apply for you, though.
Re: Export Query To Excel
I think SQL Server can do it all by itself if you create a DTS (Data Transformation Services) package that sends the query results to an Excel file, looks like an easy one (1 step or 2). Then a job can execute the package either directly or scheduled.
Re: Export Query To Excel
Quote:
Originally Posted by
Shaggy Hiker
Who would run the query? Excel can't, SQL Server can't, Access might come pretty close, and .NET can....with a few steps along the way. I have a class over in the .NET CodeBank that I wrote to export datatables and datareaders. That might not apply for you, though.
I was planning on executing the query and everything through a scheduled job. I've setup the email portion through the job. Now I just need to export the data and attach the sheet.
Quote:
Originally Posted by
jcis
I think SQL Server can do it all by itself if you create a DTS (Data Transformation Services) package that sends the query results to an Excel file, looks like an easy one (1 step or 2). Then a job can execute the package either directly or scheduled.
Everything that I've looked up so far suggests that DTS is depreciated. I'll keep looking though.
Re: Export Query To Excel
I'm not sure exactly what you want but you can put the query into Excel and run it when you open the spreadsheet. The user refreshes the data when it comes up. Look at the menu item "From Other Sources" in version 2007. I think it was "External data sources" in 2003.
Basically you set up a connection.
Step through selecting your tables etc.
Edit the query Excel created replacing it with yours.
And go
http://excelusergroup.org/blogs/nick...rnal-data.aspx
Re: Export Query To Excel
In 2010, the option is under the Data tab captioned as "connections".
You can use this to link your sheet to an external data source.
However, I am guessing that's not what you are looking for.