Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SSRS - Using Microsoft Visual Studio

Posted on 2011-03-23
4
Medium Priority
?
468 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 17

Accepted Solution

by:
dbaSQL earned 2000 total points
ID: 35204665
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
ID: 35204999
try this:
SELECT
SUBSTRING ((SELECT names + ', ' from workers for xml path('')), 1,
                     LEN((SELECT names + ', ' from workers for xml path('')))-2)
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 35452399
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In the following article I’ll be discussing and demonstrating several different ways of how images can be put on a report. I’m using SQL Server Reporting Services 2008 R2 CTP, more precisely version 10.50.1352.12, but the methods ex…
Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

715 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