Tim & Anyone Else,

I got it working using the following:

                        
vt_temp1:="2018-04-06 11:09:00 AM"
vt_temp2:="2018-04-06 11:12:00 AM"


Begin SQL
  SELECT RecordID, Mach_ID, Energy_1, Energy_2, Energy_3
  FROM DMM_TTX_HISTORIAN
  WHERE [TimeStamp] >= CONVERT(datetime,CONVERT(varchar(30),:vt_temp1), 101)
  AND [TimeStamp] <= CONVERT(datetime,CONVERT(varchar(30),:vt_temp2), 101)
  INTO :al_temp1, :at_temp1, :ar_temp1, :ar_temp2, :ar_temp3
End SQL


Hopefully this will assist someone needing to query a timestamp field in SQL.


Steve


-----Original Message-----
From: Timothy Penner [mailto:tpen...@4d.com] 
Sent: Tuesday, July 10, 2018 1:18 PM
To: s.o...@the-aquila-group.com; 4D iNug Technical <4d_tech@lists.4d.com>
Subject: RE: SQL Statement Assistance

How about?

- Using the TS syntax as described here:
http://kb.4d.com/assetid=75947

- Using CAST to cast the TEXT as a Timestamp:
http://doc.4d.com/4Dv15/4D/15/CAST.300-2288162.en.html
http://kb.4d.com/assetid=75047

- Using a C_DATE variable instead of a _CTEXT variable

-Tim



Timothy Penner
Senior Technical Services Engineer

4D Inc
95 S. Market Street, Suite #240
San Jose,CA 95113
United States

Telephone: +1-408-557-4600
Fax:       +1-408-271-5080
Email:     tpen...@4d.com
Web:       www.4D.com


**********************************************************************
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:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to