Hoping someone can point me in the right direction regarding querying a
date/time field in a SQL database:

I built the following query for testing purposes and it works just fine,
returning the correct results:

                                                Begin SQL
                                                                SELECT
RecordID, Mach_ID, Energy_1, Energy_2, Energy_3
                                                                FROM
DMM_TTX_HISTORIAN
                                                                WHERE
TimeStamp >= '04/06/2018 07:58:00 AM'
                                                                AND
TimeStamp <= '04/06/2018 08:01:00 AM'
                                                                INTO
:al_temp1, :at_temp1, :ar_temp1, :ar_temp2, :ar_temp3
                                                End SQL


I then wanted to convert this to a more generic query, so I can pass the
date/time stamps to this method, however the following did not work:
                                                
                                                vt_temp1:="'04/06/2018
07:58:00 AM'"
                                                vt_temp2:="'04/06/2018
08:01:00 AM'"

                                                Begin SQL
                                                                SELECT
RecordID, Mach_ID, Energy_1, Energy_2, Energy_3
                                                                FROM
DMM_TTX_HISTORIAN
                                                                WHERE
TimeStamp >= :vt_temp1
                                                                AND
TimeStamp <= :vt_temp2
                                                                INTO
:al_temp1, :at_temp1, :ar_temp1, :ar_temp2, :ar_temp3
                                                End SQL

NOTE:  The single quote character is included as part of the assignment:
vt_temp1 := " '04/06/2018 07:58:00 AM' "

What am I doing wrong here?

Thanks!

Steve

*********************************************
  Stephen J. Orth                                                
  The Aquila Group, Inc.         Office:  (608) 834-9213
  P.O. Box 690                           Mobile:  (608) 347-6447
  Sun Prairie, WI 53590

  E-Mail:  [email protected]
*********************************************




**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to