SQL stored procedure using values from cells into Pivot Table

K

kworth

I'm calling a stored procedure on our SQL server to generate a pivot
table. I want to be able to set one worksheet cell to a "start date"
value and one to an "end date" value, then have the stored procedure
called with these cell values as arguments @start and @end. I think I
am almost there but I don't know how to get the value from the cell
into the Pivot Table properties. If I open the Script Editor, I see the
section

<x:pTSource>
...snip..
<x:QuerySource>
...snip..
<x:CommandText>exec sp_sales '2/1/2006',
'2/28/2006';</x:CommandText>
...snip...
</x:QuerySource>
</x:pTSource>

If I change the values in the CommandText line, it make the Pivot Table
use those arguments the next time I refresh it. This is exactly what I
want, but I want to have the values of, say, cells A1 and A2 instead of
'2/1/2006' and '2/28/2006'.

Any ideas? I'm a super-noobie at programming in Excel, I'm sure this
must have a simple answer.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top