Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 19 Feb 2008 @ 12:02:10 GMT

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

Subj:   Re: SQL to populate additional data
From:   narayan.murthy

     sel * from t1;
                a            b
     -----------  -----------
                1            2     <------- we want to expand this row
                2            3

     ins into t1
     sel c1,c2 from
     (sel a, csum(1,1) from t1,(sel * from sometable sample 10) temp1
     where a =1) derv(c1,c2),t1
     where c1 = a and c2 > b;

Note: "sometable" is some table which contains a some rows which could be 10,100, 1000.... depending on how many rows you want to auto- generate.

The definition of such a table could be something like :

     Ct sometable(a int);
     Ins into sometable(1);
     .repeat 1000
     Ins into sometable select a+1 from sometable;

  <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: 28 Jun 2020