Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

CLR Aggregate to Concatenate delimited strings Expand / Collapse
Author
Message
Posted Friday, January 14, 2011 2:12 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, October 17, 2014 9:53 AM
Points: 20, Visits: 304
Comments posted to this topic are about the item CLR Aggregate to Concatenate delimited strings
Post #1048206
Posted Thursday, January 27, 2011 7:35 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 8:48 AM
Points: 988, Visits: 806
wouldn't

declare @result varchar(max);
select @result = coalesce(@result + ',' + value,value) from @codes;
select @result;

be a lot simpler?
Post #1054577
Posted Tuesday, May 17, 2011 7:43 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 10:47 AM
Points: 7,126, Visits: 12,727
david.wright-948385 (1/27/2011)
wouldn't

declare @result varchar(max);
select @result = coalesce(@result + ',' + value,value) from @codes;
select @result;

be a lot simpler?

I agree your T-SQL solution is simpler than the example code used to demonstrate how the CLR function works, however your T-SQL solution does not bring anything to GROUP BY queries where groups are being processed because COALESCE is not an aggregate function like the CLR function.

Here is a project containing several CLR User-Defined Aggregate functions that offer similar functionality to the function in the article but that will greatly outperform the function in the article for large datasets:

http://groupconcat.codeplex.com


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1110688
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse