Hi.
I have simple SQL query:
USE BEDB SELECT TOP 1 * FROM dbo.JobHistorySummary WHERE JobName = 'dbc02 BPM-Incremental' and IsJobActive not IN ('1') ORDER BY EndTime DESC
I need to change the name of the work (JobName) for each sensor.
If I understand correctly I need to write such a request:
USE BEDB SELECT TOP 1 * FROM dbo.JobHistorySummary WHERE JobName = '@prtg' and IsJobActive not IN ('1') ORDER BY EndTime DESC
And when you create a sensor in the "Input Parameters" transfer "dbc02 BPM-Inkremental" to the job name is substituted into the query.

With these settings in the logs in the variable @prtg not contain the value "Input Parameters"
Log:
24.10.16 10:55:58: Running Command 'USE BEDB SELECT TOP 1 * FROM dbo.JobHistorySummary WHERE JobName = @prtg and IsJobActive not IN ('1') ORDER BY EndTime DESC'
Article Comments
Attention: This article is a record of a conversation with the Paessler support team. The information in this conversation is not updated to preserve the historical record. As a result, some of the information or recommendations in this conversation might be out of date.
Hello Sebastian, I found a mistake! when I wrote a request I have used quotation marks. I removed them from the query and it worked.
Invalid query:
USE BEDB SELECT TOP 1 * FROM dbo.JobHistorySummary WHERE JobName = **'**@prtg**'** and IsJobActive not IN ('1') ORDER BY EndTime DESC
A valid query:
USE BEDB SELECT TOP 1 * FROM dbo.JobHistorySummary WHERE JobName = **@prtg** and IsJobActive not IN ('1') ORDER BY EndTime DESC
Oct, 2016 - Permalink
Hello dukedizel,
Thank you very much for your kb-post.
Best,
Sebastian Kniege [Paessler Support]
Oct, 2016 - Permalink