June 20, 2007 at 11:49 am
I have an xml doc that I want to pass into a proc but Im not sure exactly how to insert the nodes into a table, each node can have several nodes below it. Any help would be much appreciated.
Thanks
June 20, 2007 at 11:55 am
Use function OpenXML. B.O.L. has good examples on it.
June 20, 2007 at 11:59 am
Ok sorry I should clarify, its really not an xml doc saved on the hard drive, my application will pass in a series of xml to my stored proc.
June 20, 2007 at 1:05 pm
That's OK, Michael. That example assumes the same - passing actual XML structure as an input parameter:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/ea58e90c-0a2a-4c8f-a7d6-d61618c2d11c.htm
1. You create a S.P. with declaring a varibale as XML or nvarchar(max) data-type.
2. Execute system procedure sp_xml_preparedocument which assigns a handle to your XML input.
3. Select * from OpenXML(manipulate with your nodes and attributes here)
4. Do furget manipulation with the data.
5. Clear XML handle with another system procedure sp_xml_removedocument .
Hope this help
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply