Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Append Xml Node Without Create new IDs. with Same Root. Expand / Collapse
Author
Message
Posted Friday, September 14, 2012 5:04 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, November 30, 2014 11:17 PM
Points: 35, Visits: 42
SET @PreviousAddress = @xmlfile // Xml File With Tag i.e
UPDATE TableName SET ColummnName.modify('
insert
(
sql:variable("@PreviousAddress")
)
after
(/NewDataSet[1])
')
WHERE Condition here
SELECT '0'
Post #1359174
Posted Friday, September 14, 2012 5:19 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 4:07 AM
Points: 2,701, Visits: 1,694
I think you may need to provide a little more information on what you are trying to do, sample code and what issues/errors that you are seeing. Showing an example xml structure of what you are trying to get to or what is going wrong etc.

I've had a look at the query itself and it "looks" ok from a syntax point of view.

Are you trying to insert an xml node into an existing xml node like the following rather than appending it at the bottom of the xml structure?

DECLARE @xml XML
SET @xml = '<NewDataSet></NewDataSet>'

DECLARE @PreviousAddress XML
SET @PreviousAddress = '<PreviousAddress>asdfadsF</PreviousAddress>'

SET @xml.modify('insert (sql:variable("@PreviousAddress")) as first into (/NewDataSet)[1]')

SELECT @xml

Post #1359182
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse