• jay.schwinn (1/10/2013)


    Dwain.c,

    Thank you for your input and advice. This is indeed how I would like the final output to look. However, I need the groupId to populate automatically based on the column value of groupId

    For instance, in this case, the groupId is indeed 206, but for the next record it could be 207, or 999, or anything.

    My desired results should be a little clearer from the previous post I made to Sean.

    dwain.c (1/8/2013)


    How about something simple like this?

    DECLARE @layerXMLData VARCHAR(8000) =

    '<polygon points=''-104.80,31.57 -104.80,31.59 -104.79,31.59 -104.79,31.57 '' id=''MT-209'' />

    <polygon points=''-104.79,31.59 -104.79,31.60 -104.77,31.60 -104.77,31.59 '' id=''MT-209'' />'

    SELECT REPLACE(@layerXMLData, '/>', 'groupid=''206''/>')

    Are you saying this doesn't work?

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

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


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St