Archives of the TeradataForum
Message Posted: Fri, 30 Jul 2004 @ 13:53:35 GMT
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.
|