the smart QueryMan for this Query !!! Convert Rows to Columns

Tools
Enthusiast

the smart QueryMan for this Query !!! Convert Rows to Columns

Hi Folks
I am preparing a tool and one of the consitituents is a very simple query
Sel accessright from dbc.allrolerights

where

The output will be
CD
E
R
U
I etc

Now I want the output of the accessright column to appear column wise

CD E R U I etc
the columns will extend dynamically till all rows run out.
Can someone help ?
Thanks
V

2 REPLIES
Enthusiast

Re: the smart QueryMan for this Query !!! Convert Rows to Columns

You can't have a dynamic number of columns in the o/p

but if you are just looking for one column field that holds all these values, then you can use recursion to achieve it.
Junior Supporter

Re: the smart QueryMan for this Query !!! Convert Rows to Columns

Sieger:

I think what you are after is solved with recursive SQL.

You may take a look here: http://carlosal.wordpress.com/2008/10/15/queries-recursivas-en-teradata/. (It's in spanish!).

It will give you an idea.

HTH

Cheers.

Carlos.