Query SQL Server
I have an Excel sheet with 3 columns: PartNo, Cost and Price.
The PartNo column contains values that a user has entered. The other 2
columns (Cost and Price) contain no values currently.
I would like to populate the Cost and Price columns with values from a SQL
database using the value in the PartNo column.
I am guessing that I will loop through the PartNo column and query the
database for each PartNo to obtain the Cost and Price.
How can I retrieve values from the database and place those returned values
in their respective columns? Is there a way to perform the query and have
the results of the query stored in a variable?
I would rather place just the value in the respective column and not have
any "link". I have tried SQL.REQUEST which worked, but I am not crazy about
the fact that it refreshes automatically.
Thanks
|