Hi I'm trying to take advantage of the message function int he SQL User Experience Monitor which is described here SQL Server User Experience monitor . This allows me to pass a text field into your component similar to the PowerShell component. Basically my SQL query is running a COUNT function on the column OperationName with 3 WHERE conditions. Any of the 3 conditions represented an error condition of the application. I set the statistical threshold on the component to greater than 0 equals a critical status and it worked great.
Now my users wanted to know which condition made up the count. I decided to use the message function where I had to add a second column to the select query and thats where it broke. When testing this in SSMS and SAM it worked great unless there were no rows returned. When there was no error condition / no rows returned the monitor returns an error "Query must return at least 1 row."
Below is the SQL query I am using. I think I need to wrap this into a ISNULL condition but I can't get it to work in SAM. Please help me with my SQL query.
SQL SELECT COUNT |
---|
SELECT COUNT(*) AS Total, OperationName FROM WorkQueue WHERE OperationName LIKE '%ApplicationLicenseCountChanged%' OR OperationName LIKE '%Compliance%' OR OperationName LIKE '%Evaluation%' GROUP BY OperationName |