Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Excel 1

Status
Not open for further replies.

dmando84

Programmer
Dec 28, 2005
68
US
Hello,

I need to create a proc that reads from a SQL server table and writes to an Excel spreadsheet. Does anyone know how to accomplish this through code? Any help would be appreciated.

David
 
Without using DTS, I don't think you can. You can create a comma delimited file that you can pull into Excel, but not an actual .xls file.

Using DTS, you can export your data to the file or even create a new one with a dynamic name.


Margaret
 
Here is a link to an article with a script that will use the sp_oa* procedures to create and write to an Excel spreadsheet as a linked server. The example works for me but it generates an error that I don't understand - it may be related to the fact that I'm running SQL2005.


You may have to join the forum to get to the article but it's free.
 
Brilliant ! Thanks ...

[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top