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
 SQL Server Administration (2005)
 Hw to convert row data into multiple columns??

Author  Topic 

hirani_prashant
Yak Posting Veteran

93 Posts

Posted - 2008-04-04 : 03:18:06
Hello,

Table - 1 Format:-

Line_No Entity_Id Mid
1 1575 30
2 1575 40
3 1575 50
4 1575 60
5 1575 70
6 1575 80
7 1575 90
8 1575 100

Now i need the data into below Format :-

Line_No Entity_Id Ticker Mid1 Mid2 Mid3 Mid4 Mid5 Mid6 Mid7 Mid8
1 1575 COFP 30 40 50 60 70 80 90 100

Can any one help me out?

Thanks
Prashant Hirani

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-04-04 : 03:49:55
makes a bit more sense now you've edited it, i read it at first and thought 'stored procedures? i bet he means tables'
your original post had 2 'procs' or tables though, i'm assuming that's where the Ticker column comes from?

you can do this with PIVOT, similar to where peso showed you UNPIVOT the other day...
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=100188



Em
Go to Top of Page
   

- Advertisement -