title: Conditional reporting in SSRS
body: <p>I have a SSRS 2008 sever running in native mode.  I'm trying to figure out if the following is possible and if so, how to do it.  I would like to have a scheduled subscription that only generates a report when some condition is satisfied.  The most natural way to express the condition for me would be if a particular query comes back with data.  Is this possible?</p>
  
  <p>So basically I would check the the DB on a regular schedule and if some data is there (like in an error log) send an email about it.</p>
  
  <p>After some more research I found this link:
  <a href="http://blogs.msdn.com/b/bimusings/archive/2005/07/29/445080.aspx" rel="nofollow">http://blogs.msdn.com/b/bimusings/archive/2005/07/29/445080.aspx</a>
  where in the comments people offer the following trick:  </p>
  
  <pre><code>IF NOT EXISTS ( SELECT * FROM ....)
  
  RAISEERROR('no records found,'16,1
  
  ELSE
  
  SELECT * FROM ....
  </code></pre>
  
  <p>I can use this to either produce an email to send to or throw an error.  The problem is that my reports are wrapped in stored procedures and you can not use IF NOT EXISTS with store procs.  Does any one have any recommendations on how to check if a stored procedure returned rows without putting it into a temp table or executing it an looking at @@rowcout?  The last one is not good for me because I can't have the output of the procedure also returned along with the email. </p>