Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2009-03-31 : 14:55:14
I have a query which results the required output

Col1 Col2 Col3 Col4
---- ---- ---- -----
T1 T2 T3 55

Output:

Col
---
T1
T2
T3
55



jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2009-03-31 : 15:10:01
This would work :
Select Col1 from myTable
UNION ALL
Select Col12 from myTable
UNION All
Select Col13 from myTable
UNION ALL
Select Col14 from myTable


Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2009-03-31 : 15:20:45
Thanks
Go to Top of Page

buzzi
Starting Member

48 Posts

Posted - 2009-03-31 : 15:41:57
another way

SELECT Col
from yourtable
UNPIVOT(col FOR Col IN(col1,col2,col3,col4)) as pvt
Go to Top of Page
   

- Advertisement -