Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Passing Parameters to excel Data Connection query

Author  Topic 

shalz.leo
Starting Member

4 Posts

Posted - 2013-02-12 : 04:48:09
Hi,

I'm pulling data into excel from SQL Server 2008 using excel 2010 Data Connections.

I have a dynamic query for which the parameters have to be passed to the query.

Please let me know how to do this.

Thanks in Advance.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-12 : 05:10:23
see

http://superuser.com/questions/197453/run-an-sql-query-with-a-parameter-from-excel-2007

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

shalz.leo
Starting Member

4 Posts

Posted - 2013-02-12 : 05:41:25
Thanks for your reply. But i have multiple parameters to be passed.
I have created a stored procedure. when i run the SP in SSMS by passing parameters i'm getting the reqiured result set. i want to pass the same parameters in my excel to that SP or to the query so i can get the same result set in my excel also.my excel should ask for the parameter like how when i execute my SP..
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-02-12 : 08:48:11
Both of those requirements - multiple parameters and having the query prompt you for parameters - can be accomplished via the method described in that article. For multiple parameters, you simply repeat the process you go through for one parameter. For getting prompting for parameter values, simply do not provide a cell from which to pick up the value. Experiment with it exactly the way they are showing in that article, then try to change it and you will see that it is possible.

To use a stored proc, use syntax like "EXEC StoredProcName @param1=?, @param2=?"
Go to Top of Page

shalz.leo
Starting Member

4 Posts

Posted - 2013-02-13 : 05:16:44
Thank You!! Its working
Go to Top of Page
   

- Advertisement -