RE: How to get the row values as comma separated by a query
What I understood from your question is that you want to comma seperate the values of a particular column for its different rows. If this the question then query will be
DECLARE @SQL AS VARCHAR(500)
SELECT @SQL ISNULL(@SQL ' ')+' ' + ColumnName FROM TableName