I very often open my MSSQL2005 Mgmt studio choose my DB and table. I open the table, then click the Show diagram, criteria and show sql pane and what I wind up with is a simple ( I assume it's simple ) SQL query that looks like this.
SELECT *, QueueID AS Expr1 FROM JOBQUE_JOBS WHERE (QueueID = 165) OR (QueueID = 166)
My end goal would be to somehow incorporate a nagios or spicework script that will run every 10 minutes and if there are ever more than 10 rows in there alert me. I think I can figure out the monitoring part, I just need a way/script/code to be able to run this query from a remote computer from a command line. to be able to see the results. Is this possible?
Thanks