Just wondering if SWQL supports the "BETWEEN" operator as I can't find any information about it.
In more details, I am creating an Alert using SWQL scripts.
In some case we need to use the "Between" comparator to get the results based any data between two numbers.
The script is accepted by the Solarwinds check in the Alert but it is not running properly.
SELECT Nodes.Caption, Nodes.NodeID FROM Nodes
LEFT JOIN Traps t ON nodes.caption = t.hostname LEFT JOIN dbo.TrapVarbinds tv ON t.TrapID = tv.TrapID WHERE t.TrapID IN ( SELECT tv.TrapID FROM dbo.TrapVarbinds tv WHERE tv.OIDValue='raised(1)' ) AND t.Tag BETWEEN '16386' and '16990'
AND t.[DateTime] > DATEADD(MI,-6,GETDATE());
Could you tell me how to do a select on t.Tag that is comprised between 16386 and 16990 in the example above ?
Thanks for the information and you are right - I don' t see the Between function into the list.
Any idea on how to check if a value is comprised between two numbers ?
What should I use instead of :
t.Tag BETWEEN '16386' and '16990'?
ArrayContains([16386;16990],t.Tag) ?? Is this working ?
Any help is welcome
Have you tried using ( t.TAG > 16386 AND t.Tag < 16990 ) ?
SELECT Nodes.Caption, Nodes.NodeID
LEFT JOIN Orion.Traps t ON nodes.caption = t.hostname
LEFT JOIN Orion.TrapVarbinds tv ON t.TrapID = tv.TrapID
WHERE t.TrapID IN ( SELECT tv.TrapID FROM Orion.TrapVarbinds tv WHERE tv.OIDValue='raised(1)' )
AND ( t.Tag > '16386' AND t.Tag < '16990' )
AND t.[DateTime] > AddMonth(-6,GETDATE());
I don't have any Tags assigned to my Traps table, so struggling to test this.
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 150,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.