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 2008 Forums
 Transact-SQL (2008)
 Vertical to Horizontal

Author  Topic 

gpc44
Starting Member

35 Posts

Posted - 2012-03-29 : 03:35:56
Hi,
i want to bring rows in a Detail-Table (vertical) into horizontal Form with a T-SQL Query (max. 3 Columns). Is there a fast Way without a Cursor ?


OLD
--------------------------
Store PhoneNr
4711 49911-1111111
4711 49911-1111112
4711 49911-1111113


NEW
--------------------------
Store Phone1....... Phone2......... Phone3
4711 49911-11111 49911-11112 49911-11113

many thanks
Nicole

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-29 : 03:41:23
check out PIVOT operator


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -