Updating text within a single column, but not the entire string, duplicates string being updated

  • i had a revelation when i wake up. This is what you migth need.

    NewDocumentBodies

    AS

    (

    SELECT BodyId,

    NewBodyText = '<body>'+REPLACE(REPLACE(NewBodyText,'<','<'),'>','>')+'</body>'

    FROM (SELECT DISTINCT BodyId FROM NewLinks WHERE WasUpdated = 1 ) db

    CROSS APPLY (SELECT NewBodyText = CONVERT( VARCHAR(MAX),

    (SELECT NewLink AS 'text()'

    FROM NewLinks nl WHERE nl.BodyId = db.BodyId

    FOR XML PATH(''))

    )

    ) nt

    )

  • adrian.facio (5/31/2012)


    i had a revelation when i wake up. This is what you migth need.

    NewDocumentBodies

    AS

    (

    SELECT BodyId,

    NewBodyText = '<body>'+REPLACE(REPLACE(NewBodyText,'<','<'),'>','>')+'</body>'

    FROM (SELECT DISTINCT BodyId FROM NewLinks WHERE WasUpdated = 1 ) db

    CROSS APPLY (SELECT NewBodyText = CONVERT( VARCHAR(MAX),

    (SELECT NewLink AS 'text()'

    FROM NewLinks nl WHERE nl.BodyId = db.BodyId

    FOR XML PATH(''))

    )

    ) nt

    )

    Just what I was looking for; thanks.

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

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