470,614 Members | 1,445 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.


can 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
Jul 23 '05 #1
1 1063
Although 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

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Stefan Bauer | last post: by
28 posts views Thread by Tamir Khason | last post: by
16 posts views Thread by | last post: by
7 posts views Thread by zeyais | last post: by
33 posts views Thread by dembla | last post: by
8 posts views Thread by ginnisharma1 | last post: by
3 posts views Thread by N. Spiker | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.