Support Forums
Relative time syntax in ODBC SQL query

VTSCADA manual shows ODBC SQL query to access VTScada data from an external application like PowerBI, Python etc with explicit timestamp. e.g.,

SELECT Timestamp, 'ModDriver1:ErrorValue' from History
WHERE Timestamp BETWEEN '2014-03-01 16:54:00' AND '2014-03-01
16:55:00'

I need to write query using relative time without using explicit hard coded timestamp. i.e. timestamp between last 1 hour or last 1 day etc. Could someone please advise on the appropriate VTSCADA syntax to implement relative time references instead of explicit time in this context? I have tried a bunch of things with and without quotes like, NOW()-1D, TODAY()-1D, sysdate()-1D, systime()-1D, systimestamp-1D, GETDATE()-1D etc. But yet to make anything work. Relative time query should be a basic ask for any ODBC driver. So I must be missing something.

VTSCADA manual shows ODBC SQL query to access VTScada data from an external application like PowerBI, Python etc with explicit timestamp. e.g., ```` SELECT Timestamp, 'ModDriver1:ErrorValue' from History WHERE Timestamp BETWEEN '2014-03-01 16:54:00' AND '2014-03-01 16:55:00' ```` I need to write query using relative time without using explicit hard coded timestamp. i.e. **timestamp between last 1 hour or last 1 day** etc. Could someone please advise on the appropriate VTSCADA syntax to implement relative time references instead of explicit time in this context? I have tried a bunch of things with and without quotes like, **NOW()-1D, TODAY()-1D, sysdate()-1D, systime()-1D, systimestamp-1D, GETDATE()-1D** etc. But yet to make anything work. Relative time query should be a basic ask for any ODBC driver. So I must be missing something.

VTScada currently doesn't support relative time queries.

Perhaps the tool used to generate the SQL commands could be scripted.

VTScada currently doesn't support relative time queries. Perhaps the tool used to generate the SQL commands could be scripted.
15
1
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft