How can I repeat an SQL Excel query on individual cell values

What I'm trying to do is create an SQL query that will be executed on each row separately, taking the cell data as a criterion. i.e. I have an SQL query that retrieves a record based on student ID. I want to be able to insert a set of student IDs into column A and display each student record in the corresponding row.

Table student

STUDENT_ID FIRST_NAME LAST_NAME DOB A001 John Little 19701020 A002 Tim Henry 19690105 A003 Alex Dalton 19730312 A004 Chris Lee 19720822 A005 Susan Johnson 19710723 

Query in Excel macro: -

 select * from Table.Student where Student_Id = 'CellA1' 

Output in Excel Sheet1: -

 A001 John Little 19701020 

I'm new to SQL and databases, so I find this a little annoying. I managed to use one cell value to retrieve one record, so I needed to create a separate SQL query for each row, but this seems a bit ridiculous ...

thanks

+4
source share
1 answer

That is why I understand your question, are you looking for generating queries from data in excel columns?

As soon as you get a query, will you run it in SQL Management Studio (or another)?

0
source

Source: https://habr.com/ru/post/1336782/


All Articles