declare @result varchar(max);
select @result = coalesce(@result + ',' + value,value) from @codes;
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