In Below script in Place of & it is displaying & how to avoid amp;

  • DBA.k

    SSC Eights!

    Points: 852

    how to avoid amp;

    I don't want replace . In STUFF and XMLPATH is there any chance to avoid this ?

    DECLARE @TEMP TABLE(ID INT, [VALUE] NVARCHAR(30))

    INSERT INTO @TEMP VALUES(1 , 'MAZ')

    INSERT INTO @TEMP VALUES(1 , 'HON & DON')

    INSERT INTO @TEMP VALUES(1 , 'FOR')

    INSERT INTO @TEMP VALUES(2 , 'JEEP')

    INSERT INTO @TEMP VALUES(2 , 'CHE')

    --------------------WITH STUFF FUNCTION

    SELECT [id],

    Stuff((SELECT ',' + [VALUE]

    FROM @TEMP

    WHERE [id] = a.[id]

    FOR xml path('')), 1, 1, '') [VALUE]

    FROM @TEMP a

    GROUP BY [id]

  • jonathan.crawford

    SSCertifiable

    Points: 6348

    duplicate post of https://www.sqlservercentral.com/forums/topic/in-below-script-in-place-of-it-is-displaying-how-to-avoid-amp, see answer there

    -------------------------------------------------------------------------------------------------------------------------------------
    Please follow Best Practices For Posting On Forums to receive quicker and higher quality responses

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply