I currently have a maintenance plan in place that does a backup, re-indexing, etc. If a task fails, it sends me an email alert. I would like to add a "T-SQL Statement Task" that will execute a query and send me an email alert based on the results of the query.
Select Cast(case when count(inventory.items) > 1000 then 1 else 0 End as bit) as SendAlert From Inventory
The maintenance plan's alert function seems to be triggered whether the Query executed successfully or not -- RATHER THAN from the Query Result.
Can I accomplish what I want from within a maintenance plan or is there a better way to do this?