Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 10 Oct 2012 @ 11:41:39 GMT


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


Subj:   Re: Need to transpose a column to Row
 
From:   naresh.neelam

Hi Roopalini,

if the data look likes dynamically from source system u can use recursive query, if not,use the case logic.

     SELECT UserName, DatabaseName, TableName,
            MAX(CASE AccessRight WHEN 'R'   THEN AccessRight ELSE ' ' END)||
            MAX(CASE AccessRight WHEN 'I'   THEN ','||AccessRight  ELSE ' ' END)||
            MAX(CASE AccessRight WHEN 'U'   THEN ','||AccessRight  ELSE ' ' END)||
            MAX(CASE AccessRight WHEN 'D'   THEN ','||AccessRight  ELSE ' ' END) AS
     Access_Right
     FROM dbc.AllRights
     GROUP BY 1,2,3
     ORDER BY 1,2,3

A Small modification on James query.

please let me know if the source data looks dynamically.


Thanks,

Naresh Neelam



     
  <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