Submit a ticketCall us

AnnouncementsAre You “Flying Blind?”

When it comes to your complex IT infrastructure, you want to ensure you have a good grasp of what’s going on to avoid any fire drills that result from guesswork. Read our white paper to learn how proactively monitoring your IT environment can help your organization while giving you peace of mind.

Get your free white paper.

Home > Success Center > Network Performance Monitor (NPM) > NPM - Knowledgebase Articles > SQL or SWQL variable displayed in alert or syntax error in simulation

SQL or SWQL variable displayed in alert or syntax error in simulation

Updated November 2, 2017


This article discusses situations with custom alert variables where the SQL or SWQL does not display a resolved value.  
The error message "SQL MACRO error" can also appear


  • NPM, all versions
  • SAM, all versions


When building an alert action, it is possible to write SQL or SWQL to get a value that would be inserted into the action.  The SQL or SWQL could include the use of a SWIS variable that does resolve correctly, however the SQL/SWQL query still shows the query instead of the result of the query.


Situation #1

When simulating the action, it is possible to get "invalid syntax". Yet when the alert is triggered, the command resolves to a value. 


This is usually due to a variable in the query that would not have a valid value during the simulation, but would have a valid value when the alert was triggered.

Situation #2

When simulating or executing a custom SQL/SWQL query, the actual SQL/SWQL query is displayed, instead of resolving the query. 


This happens because the query cannot be resolved. For instance, the query resolves to no results or the query contains an invalid table.

Situation #3

The custom variable works in Trigger Actions, but does not work when used in Reset Actions. 


This could be because the tables being queried are only available during the Trigger Action and not available during Reset Action. For instance, the custom SQL/SWQL query is going against the AlertActive  table during the Trigger Action. In Reset Action, one cannot reference the AlertActive table.

Situation #4

When simulating or executing the alert, the SQL (and not SWQL) returns a SQL MACRO ERROR.  If you are on Orion 2017.3, please ensure that you have Hotfix 3 applied.



Last modified