Solved

SSRS - Using Microsoft Visual Studio

Posted on 2011-03-23
4
461 Views
Last Modified: 2012-05-11
I hope you can help.

I am using SSRS MVS - to create reports. I want to be able to combine data from rows into 1 row with comma's.

ex.

table workers

  names
----------------
 John  
  nate
  bob

I like the output to be:

john, nate, bob

_________________

How can i achieve this ?

thanks
Ethan
0
Comment
Question by:HelpMeWithSolutions
4 Comments
 
LVL 17

Accepted Solution

by:
dbaSQL earned 500 total points
Comment Utility
IF OBJECT_ID('workers','u')>0
DROP TABLE dbo.workers
GO
CREATE TABLE dbo.workers (workername varchar(10))
INSERT dbo.workers (workername)
SELECT 'John'
UNION
SELECT 'nate'
UNION
SELECT 'bob'


DECLARE @List varchar(2000)
SELECT @List = COALESCE(@List + ',', '') + workername
FROM dbo.workers

SELECT @List [List]
0
 
LVL 4

Expert Comment

by:Ztinel
Comment Utility
try this:
SELECT
SUBSTRING ((SELECT names + ', ' from workers for xml path('')), 1,
                     LEN((SELECT names + ', ' from workers for xml path('')))-2)
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hi All, I am here to write a simple article to move SSRS (SQL Server Reporting Services) reports from one server to another. When I have faced the same issue to move reports those were developed by developer on development server and now need to …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now