• Hi Sean,

    I know to print comma seperated values using FOR XML.

    But I was trying the same solution using COALESCE like this:

    DECLARE @var varchar(max)

    SELECT @var = coalesce(@var +',','') + term from Something where TYPE = 'subject'

    select @var, ID from something

    group by ID

    its printing all term values in a single line... Can you please tell me what to modify in my script to get the same output as using FOR XML as you did

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/