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
 General SQL Server Forums
 New to SQL Server Programming
 display multiple values in a column

Author  Topic 

mavericky
Posting Yak Master

117 Posts

Posted - 2011-09-27 : 15:10:18
Hi,
In a sql table, say there is a column ID. Now ID can have values from 1 to 100. I can display them in 1 column and 100 rows. Is there a way to display all of them in 1 column and 1 row, ie. in the 1st row and 1st column - 1,2,3,..., 100.

Thanks,
Mavericky

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-09-27 : 15:24:29
Why?
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2011-09-27 : 15:32:11
couple topics if you really need to to this:
How to concatenate records without UDF
Contatenation


Be One with the Optimizer
TG
Go to Top of Page

vmvadivel
Yak Posting Veteran

69 Posts

Posted - 2011-09-27 : 22:22:16
If you want to return comma separated data from a table then check this out http://vadivel.blogspot.com/2005/11/returning-comma-seperated-details-from.html

Best Regards
Vadivel

http://vadivel.blogspot.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-27 : 23:14:42
If its 2005 or above certainly FOR XML PATH method in TG s posted link performs much better than scalar UDF method

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -