MSSQL query to return results based on a list of inputs
Posted on 2014-11-06
I have the need to run a query based on the data that is saved in an excel spreadsheet. The spreadsheet has two columns and about 100 rows. The two values in each row will be plugged into the sql query. The query should loop through the list. Honestly, I can put the list in whatever format is best for this process.
My guess is that SSIS may server me best, but I have never do the looping needed to make the query run each row. Below is the very simple query with Column1 and Column2 as the variables. The Column1 data is formatted as 0000 and the Column2 data is formatted as 00000.
Please be detailed in your response because my query knowledge is somewhat limited.
select * from MHGROUP.DOCMASTER
where C1ALIAS = 'Column1' and C2ALIAS = 'Column2'