Getting criteria list for "WHERE" of TSQL from Excel
Posted on 2013-01-04
Hello To All,
Need help in structuring a Select query….
I am writing a VBA code that will run from a excel file, grab a set of dates from sheet 3and then pull data of a table in SQL Server using that set of dates as a criteria set….How to do it?
FROM [Northwind].[dbo].[Order Details]
where DateOfIssue in (select Dates from sheet3.Range("A:A50000"))
In excel file, in column A of sheet3, has a list of dates that can vary from few dates to 200-300
Sending this SQL Query from Excel VBA, - when this select statment is executed, the "Where" criteria looks at a set of dates in column B of sheet3 for getting the query results
Not sure if my query is set up correctly.