Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasescan any one give me a stored procedure which on execution creates an excel file in one of my drives(like c:\temp.xls)that contains records from a table selected which should be the argument of the stored procedure.
Post Follow-up to this messageAlthough it might be possible to write that purely in TSQL (using the sp_OA procs) you will probably find it much easier and more efficient to use DTS and then run the DTS package from a stored proc. If you aren't familiar with DTS, use the Import/Export Wizard to create a package for you and then adapt it in the designer. Alternatively, write an Excel macro to do the same thing. Excel can connect directly to SQL via ODBC. Technically you could open an Excel application object from an SP and run the macro that way (sp_OA_create again). However, I wouldn't recommend doing that as part of a production process on a server because it is hard to avoid leaking resources and RAM to dormant instances of Excel if and when the process ever fails. -- David Portas SQL Server MVP --
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread