run SQL stored procedure from Excel

By highlander718 ·
I have a stored procedure in SQL2005 that builds7refreshes a table. I cannot use SQL Views due to highly complex programming that is needed. I have an excel pivot table that uses that table afterwards.
I would like the user to be able to refresh the data in the pivot, including of course running the SQL stored procedure and than refreshing the pivot.

Any ideas would be highly appreciated.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

in SQL's microsoft query, write stored procedure's name

by joaomfferreira In reply to run SQL stored procedure ...

you can import:
- table
- query
- default (this one)

and write the SP name followed by parameters (comma between then).
Example: my_Stored_Proc 1234, 'Yes', 2008
Without paramenters is: my_Stored_Proc

If you write ?EXECUTE ? before, maybe it will work also (who cares?)
If you use microsoft Query, start by creating a new query of indiferent table.
Edit the MS Query and change the SQL statemente from ?SELECT ...something...? to your own SP, or the example ?my_Stored_Proc 1234, 'Yes', 2008?

And bingo, it works.
Im not sure if it works on Excel XP, but in 2003 and 2007 it's a charm.

Collapse -

Running a Stored procedure from Excel

by SamHow In reply to run SQL stored procedure ...


There are some Excel Add-Ins that make it easy to run a SQL stored procedure from Excel.

The one I am most familiar with is QueryCell,(I created it).

But if you search for SQL in Excel other will come up also.


Related Discussions

Related Forums