Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 07 Jun 2006 @ 17:30:57 GMT


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


Subj:   Re: SQL to Normalize Columns to Rows
 
From:   Anomy Anom

<-- Anonymously Posted: Wednesday, June 07, 2006 13:26 -->

The killer would be the transient Journal.

What you need is a multi-statement request like this:

     Insert into newtable Select A,1,Col001 Where Col001 is not null
     ; Insert into newtable Select A,2,Col002 Where Col002 is not null
     ; Insert into newtable Select A,3,Col003 Where Col003 is not null
     ; Insert into newtable Select A,4,Col004 Where Col004 is not null
     ; Insert into newtable Select A,5,Col005 Where Col005 is not null
     ; Insert into newtable Select A,6,Col006 Where Col006 is not null;

The number of INSERTS is inevitable since you are noralizing the data, but the Transient Journal can be avoided using the technique shown above.

You could use Excel to quickly build the statement.


Anonym



     
  <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