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
 General SQL Server Forums
 New to SQL Server Programming
 Excel Cell Reference

Author  Topic 

mihirvb84
Starting Member

11 Posts

Posted - 2011-12-19 : 09:34:31
I want to build a query by giving a excel cell reference for a Constraint.

TABLE - A

Person X Person Y
2008 2009 2010 2008 2009 2010
Type A 12 15 11 11 12 15
Type B 13 14 10 10 13 14
Total 25 29 21 21 25 29

For example,

Select * from Table A where Person = 'X' and Period = '2009'

Now instead putting exact value for Person and Period constraints, I want to use excel cell reference. Can anyone please let me know what changes are required in the query above for making this possible?

---------------
Mihir Borde

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-19 : 10:40:19
have a look at OPENROWSET

http://msdn.microsoft.com/en-us/library/ms190312.aspx

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

Go to Top of Page

mihirvb84
Starting Member

11 Posts

Posted - 2011-12-19 : 11:03:49
Sorry but not helpful.

quote:
Originally posted by visakh16

have a look at OPENROWSET

http://msdn.microsoft.com/en-us/library/ms190312.aspx

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





---------------
Mihir Borde
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-19 : 11:05:51
hmm...why so? what else you're expecting?

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

Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-12-19 : 12:15:09
If you are doing this from Excel, insert a question mark in the query and you will be prompted for the parameters.

Select * from Table A where Person = ? and Period = ?
Also, in the connection properties -> Properties->Parameters (from Excel), you can select a cell from which to pick up the value of the parameter.

This page has a description, but with each version of Excel, they have changed the set up and navigation to these screens that it is hard to tell without knowing your version of Excel.
Go to Top of Page
   

- Advertisement -