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.

SWQL Syntax: List of SWQL (NOT SQL) Arithmetic Operators, Keywords and Logic Operators

I've been googling the past hour and looking for a list of operators (arithmetic and logic) and all the keywords used to construct SWQL filters and queries.

So far I've found six or so different resources that give about ten examples of the "=" operator and ten examples of the "LIKE" operator which does not seem to be a comprehensive guide.

Wildcards were mentioned but it doesn't say if you can use more than one in your query -->  somevariable LIKE '%foo%' matching 'myfoobar' and 'foobar' 

Is that it?   Is that all there is?   What about "NOT LIKE", which is what I'm really after in the immediate sense?  Is there an equivalent?   The resources I found also mention that it's a read only "subset" of SQL, (I am assuming they mean MSSQL) but there isn't any real definition of what that subset actually is.

Is there a resource available somewhere that I can find this information?

Parents Reply Children
  • Thinking on the main limitations I have found in SWQL versus SQL Server is there aren't window functions, you can't declare variables or create temp tables or execute stored procedures, although the verbs pretty much are a window into the native sprocs.

  • Thanks mesverrum...  I did try the "NOT LIKE" logic in my SWQL statement but for some reason it didn't like it. I simply assumed it wasn't available, which appears to be my mistake.  I'll try again this morning and get back to you.

  • ...and I found out what I was doing but not what the problem is.   I was trying to modify the "Edit Resource: Top XX Interfaces by Percent Utilization" on the Network Top 10 default dashboard.   

    I'm unclear if this area takes the full SWQL statement or just a portion that is relevant.   For example, in SWQL Studio, this statement produces what I want without error:

    SELECT Caption from Orion.NPM.Interfaces WHERE Caption NOT LIKE '%Tunnel%'

    However, since I have to assume it's only going to pick interfaces anyway under the "filter interface" box, I tried this:

    Caption NOT LIKE '%Tunnel%'

    ...and it doesn't like that at all.  When I examine the result on the Network Top 10 dashboard, that widget simply tells me:

    Custom SQL filter is incorrectly formatted.
  • Help me, Obi Wan mseverrum, you're my only hope! Laughing

  • You need to use the following as the resource doesn't know whether you are looking at Node or Interfaces caption. Also take note that some of the widgets used SWQL and some use SQL filters to the syntax may change. 

    Interfaces.Caption NOT LIKE '%Tunnel%'

    If you wanted to filter by node caption you would use:

    Nodes.Caption NOT LIKE '%SW45%'

    The SWQL/SQL format also changes how you reference custom properties:

    SQL: Interfaces.Comments = 'Blah'

    SWQL: Interfaces.CustomProperties.Comments = 'Blah'

  • Thank you shuth!!  That worked perfectly.