Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 19 Feb 2008 @ 15:07:16 GMT


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


Subj:   Re: SQL to populate additional data
 
From:   Michael Larkins

Hi Michele:

Here is the code to generate the desired rows using your table names:

     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

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.

So, you would need to export these created rows using a select from your client and then import them using an insert using your client.


Regards,

Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor



     
  <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