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)
 showing rows as column

Author  Topic 

Deep123
Starting Member

8 Posts

Posted - 2009-06-10 : 03:39:18
i hav two tables question(id,question ) and child table options(qid,options)

now i had to show this way

question opt1 opt2 opt3 opt4

how i will do this

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-10 : 03:41:26
Use the PIVOT operator available in SQL Server 2005.
If the column names are dynamic, you have to resort to dynamic sql crosstab/pivot function.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-06-10 : 03:41:38
use pivot or dynamic cross tab
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-06-10 : 03:41:58
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/dynamic-crosstab-with-multiple-pivot-columns.aspx
Go to Top of Page
   

- Advertisement -