title: Is there a way to perform an IF() evaluation and execute a stored procedure all on one line?
body: <p>Is there a way to write this so it can be all on one line of code?</p>
  
  <pre><code>IF (ISNULL(@param1,'1') = '1' AND ISNULL(@param2,'') = '') 
     exec sp_CheckNill @param2, '@param2 cannot be NULL if @param1 is NOT NULL'
  </code></pre>
  
  <p>For the inevitable "why?" questions:  besides being more compact, if I'm doing lots of these in a row, readability is far better as the individual differences between each line are for more distinct.</p>
  
  <p>EDIT:</p>
  
  <p>I'm an idiot.  All on one line does work:</p>
  
  <pre><code>IF (ISNULL(@param1,'1') = '1' AND ISNULL(@param2,'') = '') exec sp_CheckNill @param2, '@param2 cannot be NULL if @param1 is NOT NULL'
  </code></pre>
  
  <p>I'd delete the question, except @James below posted an informative related answer.</p>