title: SQL: Can you chain table valued functions without using a table variable/temp table?
body: <p>Is there any way to do something like:</p>
  
  <pre><code>select * from dbo.tvFunctionA(select * from dbo.tvFunctionB())
  </code></pre>
  
  <p>without using an intermediate table variable?</p>
  
  <p>The reason I'm asking, is because I have something like this:</p>
  
  <pre><code>create function dbo.tvFunctionA()
  returns table as return
  with B as (
      select * from dbo.tvFunctionB()
  )
  select
      blah, blah, blah
  join B B1 ...
  join B B2 ...
  ...
  join B B99 ...
  </code></pre>
  
  <p>and apparently the WITH CTE is low performance.</p>
  
  <p>I would like to speed up the ITVF and am attempting to pull out the CTE table and use it as a parameter.</p>