This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

String to date conversion in SWQL

Is it possible to convert a string value to the date format with SWQL somehow?

I have some metrics from custom poller:

CurrentValue Caption
03/15/2021 a.host
04/25/2021 b.host
11/13/2020 c.host
Unknown d.host
09/06/2021 e.host


"CurrentValue" contains a date in MM/DD/YYYY format (actually a string value), and I want to compare it with the current date minus 180 days.
Comparison is not working with this query, and I think because "CurrentValue" type is not a "date":

SELECT UDCP.CurrentValue, UDCP.Node.Caption

FROM Orion.NPM.CustomPollerAssignment UDCP

WHERE Displayname = 'Battery_last_test'
    AND CurrentValue NOT LIKE 'Unknown'
    AND CurrentValue < ADDDAY( -180, GETDATE() )

It pops timeout error.


Found some info about DateTime function, but I can't make it work:

So I'd like to convert it to the date type before comparison. Is this possible?

Parents Reply Children