In one of my previous posts, I talked about generating a comma separated list in TSQL. One of my readers has pointed out some interesting facts about issues related to this approach.
Following are the issues documented at MSDN
Execution Plan and Results of Aggregate Concatenation Queries Depend Upon Expression Location
So what should we do now?
An alternative approach is to use For XML to generate comma separated list. Full working example is available at:
http://milambda.blogspot.com/2005/07/return-related-values-as-array.html
and
http://sqlblogcasts.com/blogs/tonyrogerson/archive/2006/07/06/871.aspx