Submit a ticketCall us

Training Class Getting Started with SolarWinds Backup - February 28

This course offers customers an introduction to SolarWinds Backup, focusing on configuring the backup technology, taking backups, data restoration and data security. It is a great primer and will get you up to speed quickly on SolarWinds Backup.
Register for class.

Home > Success Center > Network Performance Monitor (NPM) > 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