how to select this xml in sql server 2008

Knoxx

New Member
I need to select all guid node in the xml. but the code below only select the first one of them. how to do it?\[code\]DECLARE @doc XMLSET @doc = '<ArrayOfGuid xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <guid>96eecbe2-d645-465d-8232-c7f21e3c6bf8</guid> <guid>38985702-0c0b-4e9c-bccb-af84ba4dd7ff</guid> <guid>67852205-092e-4db8-b31e-6f5d457db294</guid> <guid>92cf9106-445f-4b01-8259-613596b8a2a7</guid> </ArrayOfGuid>'DECLARE @docHandle INTEXEC sp_xml_preparedocument @docHandle OUTPUT, @docSELECT [guid]FROM OPENXML(@docHandle, '/ArrayOfGuid', 2) WITH ([guid] UNIQUEIDENTIFIER)\[/code\]the result is just one row: 96EECBE2-D645-465D-8232-C7F21E3C6BF8I need all 4 rows.
 
Back
Top