Is it possible to display in the results-window of a query in TSQL (SSMS) window conditionally?
For example, display column-header and result of:
SELECT COUNT(1) AS ourCount FROM [ourDatabase].[dbo].[ourTable]
only if it is > 0
NOTE: We use SQL Server 2008, r-2
This is in the context of a larger system of queries with many results. I don't want to clutter the results if this particular query has a zero-value. Of course, the concept could be generalized for other situations.
So I am monitoring the query output, and one could think of the results as an 'alert' to myself (informally).
WHEREclause of a SELECT statement, or theHAVING()clause if you want to filter by an aggregate.