Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 19 Feb 2008 @ 17:58:32 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: SQL to populate additional data
 
From:   Howard Bradley

  Here is the problem that I did not realize previously: when using a derived table like this, select seems to be the only valid command. It would not let me do an insert/select.  


Michael

I have a query which Inserts the results from a recursive query into a table.

The syntax in this case would be :

     Insert into mytable
     with recursive temp (a2, b2,lvl) as
        (sel product, max(cast(expanded_product as smallint)),0
          from prod where product like '%X'
          group by 1
           union all
         sel a2,b2+1,lvl+1 from temp  where lvl < 9
     )
     sel a2,cast(b2 as char(4)) from  temp where lvl > 0;


     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023