• Dwain,

    It looks like my last post #1405712 was posted less than a minute after your new suggestion, so that post was actually a reply to your first comment, not your new suggestion.

    I tried your statement and got

    "Msg 8116, Level 16, State 1, Line 1

    Argument data type text is invalid for argument 1 of replace function."

    Thanks!

    Are you saying this doesn't work?

    SELECT REPLACE(layerXMLData, '/>', 'groupid=''' + CAST(groupid AS VARCHAR(5))+ '''/>')

    FROM [LOCAL_TEST].[dbo].[testtable10]