Transpose Table

14/04/2004 - 19:23 por Christian.Akcoskun | Informe spam
How can i transpose a Table in Micrososft SQL... I have to switch rows
into columns. For example:

Col1 Col2 Col3
******************
aaaa 1111 2222
bbbb 3333 4444
cccc 5555 6666

And i Want to transpose it to:

Col1 Col2 Col3
******************
aaaa bbbb cccc
1111 3333 5555
2222 4444 6666

I have to do this in an SP.
Thank you very much
chris
 

Leer las respuestas

#1 Aaron Bertrand [MVP]
14/04/2004 - 19:32 | Informe spam
Cross-tab, see http://www.aspfaq.com/2462

Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Chris Akco" wrote in message
news:
How can i transpose a Table in Micrososft SQL... I have to switch rows
into columns. For example:

Col1 Col2 Col3
******************
aaaa 1111 2222
bbbb 3333 4444
cccc 5555 6666

And i Want to transpose it to:

Col1 Col2 Col3
******************
aaaa bbbb cccc
1111 3333 5555
2222 4444 6666

I have to do this in an SP.
Thank you very much
chris

Preguntas similares