Including date in SQL Where-clause in Excel 2007
I have a table Customers in an external Excel file, which has among others two date fields Started and Ended. In calculation I need to query records where parameter myDate is between Started and Ended. I cannot figure out the Where syntax.
In the Excel source file I can retrieve these record with simple excel functions, so it really works. I have also used the wizard to create the whole SQL statement and this way its working too. However, this where-statement looks like WHERE (Customers.Started<={ts 2017-10-17 00:00:00}) AND (Customers.Ended={ts 2017-10-17 00:00:00}). What do the curly brackets mean? What does the ts mean? In my coded snippet I use ADODB ..Provider = "Microsoft.ACE.OLEDB.12.0" .ConnectionString = "Data Source=" & DBPath & ";" & _ "Extended Properties=""Excel 12.0 Xml;HDR=YES"";" How should a simple where statement look like to work in this case? //Håkan |
Including date in SQL Where-clause in Excel 2007
What do the curly brackets mean? What does the ts mean?
What happens if you leave those out? What is the format of the 2 date/time columns? RBS |
Including date in SQL Where-clause in Excel 2007
On Tuesday, October 17, 2017 at 6:58:13 PM UTC+3, wrote:
What do the curly brackets mean? What does the ts mean? What happens if you leave those out? What is the format of the 2 date/time columns? RBS In fact I found a work-around: I changed all dates to numeric value built up of yyyyMMdd. Date format seem to confuse SQL. I thought it handles the dates as Excel serial numbers. HBJ |
All times are GMT +1. The time now is 08:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com