Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Daniel Seipel" wrote:
I have a spreadsheet that I receive daily. there are about anywhere from 50-1000 values in column A that I need to query an sql database for.The spreadsheet name changes daily and the number of rows change daily. It's always column A (with a header). I'd like to program excel to start at cell A2, do the query, return the results to a new workbook, and continue down the list until the end. No need to loop through the values row-by-row. SQL is a set based language and, using Jet's ability to create a join between a table (e.g. Excel range) and an odbc table, you can get all the data you need (no more, no less) in one hit e.g. something like: SELECT MSSQL.key_col, MSSQL.data_col FROM [ODBC;Driver={SQL Server};SERVER=MYSERVER;DATABASE=MYDATABASE;UID=** *;Pwd=***;].MyTable AS MSSQL RIGHT JOIN [Excel 8.0;HDR=NO;Databse=C:\MyWorkbook.xls;].[MySheet$A2:A65535] AS XL ON MSSQL.key_col = XL.F1 ORDER BY XL.F1; Jamie. -- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Dynamic URL for first column of data from excel query? | Excel Discussion (Misc queries) | |||
Importing Data via Web Query - Can values be passed to query? | Excel Discussion (Misc queries) | |||
Excel query via ODBC cuts values | Excel Discussion (Misc queries) | |||
Excel formula, 2 colons query to sum values in colon 3 | Excel Programming | |||
Q) Last row/column ------ excel formula query | Excel Programming |