ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sql that will refer to a cell in excel (https://www.excelbanter.com/excel-programming/370628-sql-will-refer-cell-excel.html)

zero6060

sql that will refer to a cell in excel
 
How can I write a sql statement that will refer to a cell in excel.
I would like to do a date range like =<"B2" and ="B3"
and a parameter =<"C2" and ="C3"

You get my point...

I didn't want to write the statement in excel, because excel is slow pulling
data from a huge data base (up to a minute) using several tables, where if I
write the sql directly to the data base it returns data in just a few
seconds. But then I can't use excels convenient parameters

NickHK

sql that will refer to a cell in excel
 
Assuming this in VBA:
Dim SQLString as string
SQLString="SELECT * FROM YourTable WHERE IssueDate <= #" & Range("B2").Value
& "# AND IssueDate = #" & Range("B3").Value & "#"

The exact syntax will depend on the database provider/engine etc you are
using, but something like that.

NickHK

"zero6060" wrote in message
...
How can I write a sql statement that will refer to a cell in excel.
I would like to do a date range like =<"B2" and ="B3"
and a parameter =<"C2" and ="C3"

You get my point...

I didn't want to write the statement in excel, because excel is slow

pulling
data from a huge data base (up to a minute) using several tables, where if

I
write the sql directly to the data base it returns data in just a few
seconds. But then I can't use excels convenient parameters





All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com