Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
hbj hbj is offline
external usenet poster
 
Posts: 35
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
hbj hbj is offline
external usenet poster
 
Posts: 35
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenate including a date so that the date appears as a date Zembu Excel Worksheet Functions 2 January 6th 10 06:09 PM
Can I use a between clause or in clause on an IF statement ssciarrino Excel Programming 2 May 4th 07 04:48 PM
Including today's date Rich D Excel Discussion (Misc queries) 3 December 8th 06 08:19 PM
Mimicking an GroupBy Clause in Excel GreyPilgrim Excel Programming 3 February 1st 06 08:15 PM
VBA excel - problem with having clause in sql with adodb.connection/recordset ukp9999 Excel Programming 3 November 21st 05 07:48 AM


All times are GMT +1. The time now is 12:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"