Return rows from XQuery
running the following code:
declare @x xml
set @x='<ManuInstructions ProductModelID="1" ProductModelName="SomeBike" >
<Location LocationID="L1" LocationName="Name 1" />
<Location LocationID="L2" LocationName="Name 2" />
</ManuInstructions>'
SELECT @x.query('
for $location in /ManuInstructions/Location
return data($location/@LocationID)
') as LocationID
I get the following result:
LocationID How can I get two rows instead ?, ie.: LocationID Thanks,
-
L1 L2
(1 row(s) affected)
-
L1
L2
(2 row(s) affected)
Pierre

