title: Return Stored Proc Results in CTE
body: <p>Is it possible for me to call a stored proc into a CTE. I have a login to our reporting DB that is only RO. I have write access to our UAT but would like to query live data.</p>
  
  <p>So can I use a stored proc in a CTE?</p>
  
  <pre><code>with clientOwes as (
    exec des_Batch_GetApplicationClientOwesList
  )     
  select a.des_applicationnumber 
  from des_heapplicationset a 
  where a.des_heapplicationid in (select applicationid from clientowes)
  </code></pre>
  
  <blockquote>
    <p>result was: <em>Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'exec'.</em></p>
  </blockquote>