Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 30 Jul 2004 @ 13:53:35 GMT


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


Subj:   Re: Macros: Treating a parameter as an object
 
From:   Jim Downey

I don't have time to check this out but I slight modified your code to concatenate all columns into one column using the value in the column specified and the empty string in all the other columns.

     REPLACE MACRO MyMacro (colname char(30)) AS (
     SELECT
        CASE  WHEN :colname = 'CHECK_ID'   THEN Coalesce(CHECK_ID,'')
                                           ELSE '' END) ||
        CASE  WHEN :colname = 'BIRTH_DATE' THEN Coalesce(BIRTH_DATE,'')
                                           ELSE '' END) ||
        CASE  WHEN :colname = 'OPEN_DATE'  THEN Coalesce(OPEN_DATE,'')
                                           ELSE '' END)
     FROM
           mydb.mytable
     GROUP BY 1;)     ;

You would have to work with each individual column based on data type so you get the results you want.



     
  <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