0

I want to use 2 columns in excel (A & B) as parameters in an SQL query to an SQL Server. I then want to drag the query down 200 lines to select the required data from the DB.

Pic with Example

I have tried

Get Data > From Microsoft Query - Didn't work. It just doesn't seem to be the right avenue for this (ie: No option for this).

Get Data > From SQL Server Database and it brings up Navigator and I see a preview of the data. I don't want to import all the data though. I want to customize a query and only import that data.

This is not a duplicate of How do I write a query in Microsoft SQL Server Management Studio and then use that Query in Excel since those steps don't work in Excel 2016.

Adrian
  • 141
  • 1
  • 9
  • Since you are trying to get data from Excel to SQL then U may use,, `SELECT Col, Col2 FROM [sheet1$A1:D25] WHERE COLNAME in (SELECT * FROM [sheet1$F1:F2])`,, here `A1:D15` works as database and `F1:F2` as Parameter cells. If U are thinking get Data from SQL the better use `Get Data from SQL` and follow the procedure and in design view you can write SQL statement ! – Rajesh Sinha Mar 08 '20 at 06:28
  • This [answer](https://superuser.com/questions/1530465/enable-an-excel-com-add-in-for-one-and-only-one-workbook) may work for you... – gns100 Mar 09 '20 at 18:55

0 Answers0