Start property processing with ExecSQL

  • Thread starter Thread starter DENNIS BROWN
  • Start date Start date
D

DENNIS BROWN

Hi,
I need to get a range of dates and store them, and I'm using MAPITable with ExecSQL, but I'm stuck on Start property processing.
What is the correct format when I'm searching for a string within a stored field?
For example, if I retrieve the Start property of an appointment, I get 6/27/2007.
How do I pass that in the SQL string as the first point in my search, and increment it by 10 days as the end point in my search?
Example of what I'm trying to do is
(MyStartPointDate contains "6/27/2007" and MyEndPointDate contains "7/7/2007")
ExecSQL("Select Start From Folder Where Start => MyStartPointDate AND Start =< MyEndPointDate")
Since the Start might contain something like "6/27/2007 9:30:00", how do I get the SQL to use just the date portion, or will it find any date containing the date stored in MyStartPointDate?
What does it do, just search for the literal string stored?
 
The dates must be in the standard SQL format - yyyy-mm-dd hh:nn:ss:zzz.
Dates are not strings, so "contains" is not at all applicable; you must
always use ranges (date >= date1 and date <= date2)
Also keep in mind that instances of recurring activities do not exist, so
you would need to perform a restriction on the clip start/end (rather than
start/end) and then expand the recurrences to see if any of them fall into
the specified range, plus your restriction will miss appointments that start
*before* the start date but end after the start.
It looks like what you really need is RDOFolder2.GetActivitiesForTimeRange -
it will perform the restriction for you and expand recurrences
appropriately.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Hi,
I need to get a range of dates and store them, and I'm using MAPITable with
ExecSQL, but I'm stuck on Start property processing.
What is the correct format when I'm searching for a string within a stored
field?
For example, if I retrieve the Start property of an appointment, I get
6/27/2007.
How do I pass that in the SQL string as the first point in my search, and
increment it by 10 days as the end point in my search?
Example of what I'm trying to do is
(MyStartPointDate contains "6/27/2007" and MyEndPointDate contains
"7/7/2007")
ExecSQL("Select Start From Folder Where Start => MyStartPointDate AND Start
=< MyEndPointDate")
Since the Start might contain something like "6/27/2007 9:30:00", how do I
get the SQL to use just the date portion, or will it find any date
containing the date stored in MyStartPointDate?
What does it do, just search for the literal string stored?
 
Back
Top