• In the original posting, the query should be

    SELECT @listValues = ISNULL( @listValues + @delimeter,'') +

    ISNULL(FirstName,'')

    FROM #Table1

    ORDER BY FirstName

    The original query will not include empty fields for NULL names, and worse, if you change the "ORDER BY" clause, it will re-start the lilst values variable every time a NULL name value is encountered. The first ISNULL is to skip the delimiter for the first field, the second is to make sure NULL values show up as empty fields.