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.

Reference for SWQL Studio versus SWQL Custom Query Resource?

Hello all,

I was wondering if anyone has created a thread that documents all the pitfalls when trying to use the SWQL Custom Query Resource as compared to SWQL Studio?  I have seen several good threads on the topic by mwb but I still struggle when trying to implement this feature because of these differences.  My current case in point is a simple query showing all the disk space we are monitoring:

SELECT ROUND(SUM(VolumeSpaceUsed)/1099511627776, 1) AS TOTAL_TB

FROM Orion.Volumes V

INNER JOIN Orion.Nodes N ON (N.NodeID = V.NodeID)

INNER JOIN Orion.NodesCustomProperties NC ON (N.NodeID = NC.NodeID)

WHERE MachineType LIKE '%Window%'

This works great in SWQL Studio, but not so much in the SWQL custom Query.

  • I'll second that.  With the SWQL language being custom, it's very frustrating to write something in SWQL Studio and not be able to just copy and paste to a resource (or vice-versa).  I feel like I don't see the same differences when refining SQL queries in SQL Management Studio and building a report, etc.

  • Quite often it's simply a missing ORDER BY clause.  In this case, simply do this:

    SELECT ROUND(SUM(VolumeSpaceUsed)/1099511627776, 1) AS TOTAL_TB

    FROM Orion.Volumes V

    INNER JOIN Orion.Nodes N ON (N.NodeID = V.NodeID)

    INNER JOIN Orion.NodesCustomProperties NC ON (N.NodeID = NC.NodeID)

    WHERE MachineType LIKE '%Window%'

    ORDER BY TOTAL_TB

    And it should work.  Something to do with SWQL needing this in order to do the "Row Windows" properly.   You can find a more detailed explanation by searching if you want.  All I know is it usually works for me!!  emoticons_happy.png

  • that helps in the short run, thanks Craig!  I guess I will have to start thread or something for Custom SWQL Reference Posts....