Xquery

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi all

I want to do some modification in my xmldata in xmldata column .
<root>
<DateOfBirth>12/22/1988 </DateOfBirth>
<Gender> 1 </Gender>
<Country>Bolivia </Country>
<moreDetails>
<AreaId>524</AreaId>
<City />
<State/>
<country />
<Pincode />

</moreDetails>

</root>
in the above xml i have to replace aall the child node of Moredetalis
wat query is best suited for that work


Regards,
Mukesh Kumar Agarwal
Senior Software Engineer
Efextra Solutions Pvt. Ltd
Noida- 201301
Delhi India
 
I think in general you could do something like this:

load the xml into an XMLDocument - Dim doc as XmlDocument =
XmlDocument.Load(...)

create an XmlDocumentFragment - Dim frag as XmlDocumentFragment =
doc.CreateDocumentFragment

write the new <moreDetails> to the frag

replace the existing <moreDetails> doc.ReplaceChild(frag, node to replace)

Totally untested, but I think you get the general idea.

Rick
 
Hey Rick

I want to perform the action in storedprocedure
--
Regards,
Mukesh Kumar Agarwal
Senior Software Engineer
Efextra Solutions Pvt. Ltd
Noida- 201301
Delhi India
 
Hi,
You can use the OPENXML function. The idea here is to
create a SProc to which
you'll pass your XML (usually as an NTEXT parameter). In the SProc you use
sp_xml_preparedocument to generate an in-memory "DOM-like" tree structure,
and then use OPENXML to shred the XML into relational rowsets. Below is a
link explaining how to use OPENXML that might help you get started (search
for "Using OPENXML"
in any search engine and you'll find some examples
there.)http://www.awprofessional.com/articles/article.asp?p=102307&seqNum=6&rl=1

Thanks and Regards,
Manish Bafna.
MCP and MCTS.
 
Back
Top