• Hm, is someone able to explain this?

    Same code as before, but positioned order by (1 instead of i) and "-" as separator for better readability.

    SET NOCOUNT ON

    create table #xxx (i int identity, a varchar(3))

    go

    declare @txt varchar(255)

    set @txt = 'Question' select @txt = isnull (a, '?') from #xxx order by i insert #xxx values ('of')

    insert #xxx values ('the')

    insert #xxx values ('day') select @txt = @txt + '-' + a from #xxx order by 1

    select @txt

    DROP TABLE #xxx

    Result:

    Question-the

    Looks like only the first or last (depending on DESC or ASC sort) row is used in the end result.

    Is that expected behaviour?

    Best Regards,

    Chris Büttner