• hi,

    I would either use one of both solutions:

    DECLARE @Concat NVARCHAR(MAX) = '' ;

    SELECT @Concat = @Concat + ', ' + StatusDesc

    FROM MyStatus ;

    SELECT STUFF(@Concat, 1, 2, '') ;

    -- or

    DECLARE @Concat2 NVARCHAR(MAX) ;

    SELECT @Concat2 = COALESCE(@Concat2 + ', ', '') + StatusDesc

    FROM MyStatus ;

    SELECT @Concat2 ;

    The use of COALESCE is interchangeable with ISNULL in this case. The use of SUBSTRING and LEN is not necessary when you use STUFF. Also I would not limit the length of the result variable to any arbitrary value.

    The FOR XML PATH approach is in this case also viable when I only want to issue one single command or when we need to concatenate values in groups.