• The query can be made to handle XML special characters by doing this

    SELECT t.id,

    STUFF(

    (

    SELECT ';'+x.col1

    FROM @MyTable x

    WHERE x.id=t.id

    ORDER BY x.col1

    FOR XML PATH(''),TYPE

    ).value('.','VARCHAR(1000)'),1,1,'') as con_str

    FROM @MyTable t

    GROUP BY t.id;

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537