title: TSQL Is there a way to skip execution of functions in INNER JOIN clause?
body: <p>I have the following SQL statement:</p>
  
  <pre><code>FUNCTION F1
  INNER JOIN TABLE T1
  INNER JOIN FUNCTION F2 
  INNER JOIN FUNCTION F3
  INNER JOIN FUNCTION F4
  ...
  INNER JOIN TABLE T2
  </code></pre>
  
  <p>In some situations when <code>FUNCTION F1</code> returns no records the wholes statement is executed for <code>12</code> seconds. </p>
  
  <p>The <code>FUNCTION F1</code> execution time (alone) is <code>4</code> seconds.
  If I leave joined only <code>FUNCTION F1</code> and the tables the exectuin time is again <code>4</code> seconds.</p>
  
  <p>So, the SQL Server is exectuing the rest of the functions which increase the execution time of the statement.</p>
  
  <p>Why SQL Server is not skipping the execution since there is <code>INNER JOIN</code> clause and the first function returns nothing?Is there a way to fix this behavior?</p>