Concatination in Report
Hi, In my report Names are getting displayed in Multiple rows like Name Skill abc .NET abc SQL SERVER abc Sharepoint It must be shown like Name Skill abc .NET,SQL SERVER,Sharepoint How can i do this in SSRS report THANK U
December 30th, 2010 3:09am

CREATE TABLE #mable(mid INT, token nvarchar(16)) INSERT INTO #mable VALUES (0, 'foo') INSERT INTO #mable VALUES(0, 'goo') INSERT INTO #mable VALUES(1, 'hoo') INSERT INTO #mable VALUES(1, 'moo') SELECT m1.mid, ( SELECT m2.token + ',' FROM #mable m2 WHERE m2.mid = m1.mid ORDER BY token FOR XML PATH('') ) AS token FROM #mable m1 GROUP BY m1.mid ;Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Free Windows Admin Tool Kit Click here and download it now
December 30th, 2010 3:39am

Truncate the "," that appear at the end using below syntax select mid,substring(token,1,len(token)-1) token from (SELECT m1.mid, ( SELECT m2.token + ',' FROM #mable m2 WHERE m2.mid = m1.mid ORDER BY token FOR XML PATH('') ) AS token FROM #mable m1 GROUP BY m1.mid) b ; Hope this helps Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. BH
December 30th, 2010 4:20am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics