Quantcast
Channel: THWACK: Popular Discussions - Alert Lab
Viewing all articles
Browse latest Browse all 8833

Advanced Alerts triggered with SQL and SW STRING variables

$
0
0

Hi everyone;

 

I’m trying to add a SQL sentence in a email triggered alert using the Advanced Alert Manager. The problem is with any string SW variables, in my case is with ${UniqueID} located in the SQL VIEW named CustomPollerStatusTable.

 

The SQL sentence in the email alert is:

Alert Sentence: ${SQL:SELECT Value FROM CustomPollerStatusTable INNER JOIN CustomPollers ON CustomPollerStatusTable.PollerID = CustomPollers.CustomPollerID WHERE UniqueName = 'GBAvailable' AND UniqueID=${UniqueID}}

Parse Expected: SELECT Value + ' GB' FROM CustomPollerStatusTable INNER JOIN CustomPollers ON CustomPollerStatusTable.PollerID = CustomPollers.CustomPollerID WHERE UniqueName = 'GBAvailable' AND UniqueID=9D8ACCF6-BA7F-4FF0-8512-CF3A110ECD31

Result in the email sent: MACRO SQL ERROR - Incorrect syntax near '9D8'.

As you can see it will fail because legally in SQL the SW variable should be surrounded it by quotes.

 

Now if we add the quotes:

Alert Sentence: ${SQL:SELECT Value FROM CustomPollerStatusTable INNER JOIN CustomPollers ON CustomPollerStatusTable.PollerID = CustomPollers.CustomPollerID WHERE UniqueName = 'GBAvailable' AND UniqueID='${UniqueID}'}

Parse Expected: SELECT Value + ' GB' FROM CustomPollerStatusTable INNER JOIN CustomPollers ON CustomPollerStatusTable.PollerID = CustomPollers.CustomPollerID WHERE UniqueName = 'GBAvailable' AND UniqueID='9D8ACCF6-BA7F-4FF0-8512-CF3A110ECD31'

Result in the email sent: ${SQL:SELECT Value + ' GB' FROM CustomPollerStatusTable INNER JOIN CustomPollers ON CustomPollerStatusTable.PollerID = CustomPollers.CustomPollerID WHERE UniqueName = 'GBAvailable' AND UniqueID='$@UniqueID@'}

As you can see it fails again by sending the SQL statement and not executing it at all.

 

Do you have any ideas on how to set a SW string type variable into a SQL statement?

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 8833

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>