Dear all,

I have the following stored procedure:

DECLARE @idoc int
DECLARE @doc varchar(1000)
SET @doc ='
<?xml version="1.0" encoding="utf-8"?>
<Vehicle xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" productionOrderId="13715" calculationPlanId="24" calculationPlanReleaseId="71" errorDescription="XXX">
<ParameterErrors>
<ParameterId xsi:type="xsd:int">10211</ParameterId>
<ParameterId xsi:type="xsd:string">1014;1015;1016;</ParameterId>
</ParameterErrors>
<FunctionErrors>
<FunctionError xsi:type="FunctionError">
<CalculationPlanListId>29126</CalculationPlanListId>
<FunctionId>2</FunctionId>
<Description>Input string was not in a correct format.</Description>
</FunctionError>
<FunctionError xsi:type="FunctionError">
<CalculationPlanListId>29127</CalculationPlanListId>
<FunctionId>3</FunctionId>
<Description>Input string was not in a correct format.</Description>
</FunctionError>
</FunctionErrors>
</Vehicle>'

EXEC sp_xml_preparedocument @idoc OUTPUT, @doc


/*
SELECT *
FROM OPENXML (@idoc, '/Vehicle/FunctionErrors/FunctionError', 2)
WITH (CalculationPlanListId int, FunctionId int, Description nvarchar(255))
EXEC sp_xml_removedocument @idoc
*/

SELECT *
FROM OPENXML (@idoc, '/Vehicle/ParameterErrors/ParameterId',3)
WITH (ParameterId nvarchar(100) '../ParameterId')

EXEC sp_xml_removedocument @idoc


Problem:

My output is:

ParameterId
10211
10211

in stead of
10211
1014;1015;1016

Does anyone have a suggestion ?

Question:
Is it possible to read the data in the <ParameterErrors> and <FunctionErrors> tags in one statement. Now I use two statements as you can see on the commented block in the stored procedure.