title: Inserting the result of a with cte query into a Temp Table
body: <p>I want to store the result of this query into a temp table:</p>
  
  <pre><code>WITH cOldest AS
  (
      SELECT 
         *, 
         ROW_NUMBER() OVER (PARTITION BY [MyKey] ORDER BY SomeColumn DESC) AS rnDOB 
      FROM MyTable
  )
  SELECT
      C.*
   ***    Insert into #MyTempTable *** This part doesn't work  
       FROM
       cOldest C
       WHERE
       C.rnDOB = 1
  </code></pre>
  
  <p>Thanks in advance. </p>