Question Locked

run SQL stored procedure from Excel

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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.

4 replies

by joaomfferreira

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.

by samhow

Hi,

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).

www.QueryCell.com

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

Cheers
Sam

This discussion is closed to new replies.