Need
I'm having the data as shown below. I want table results in the form of xml .So I'mUSINGXMLPATHTOGETtheresults.ButI'm looking for speciifc format .'
--Declare a table variable
DECLARE@ProcessingTABLE(CaseDataKeyINTIDENTITY(1,1)PRIMARYKEY
,CaselistVARCHAR(8));
--Populate the table variable with the list of Caselist
INSERTINTO@Processing(Caselist)
SELECT '23456' UNIONALLSELECT '4321'
SELECT*FROM@Processing
FORXMLPATH('Results')
above
querywillgivemether esults ASshownbelow:
above querywillgivemether esults ASshownbelow:
<Results>
<CaseDataKey>1</CaseDataKey>
<Caselist>23456</Caselist>
</Results>
<Results>
<CaseDataKey>2</CaseDataKey>
<Caselist>4321</Caselist>
</Results>
I wantTOGETtheresultsASshownbelow:
<Results>
<InfofieldName="CaseDataKey"Value="1"/>
<InfofieldName="Caselist"Value="23456"/>
</Results>
<Results>
<InfofieldName="CaseDataKey"Value="2"/>
<InfofieldName="Caselist"Value="4321"/>
</Results>
how should IMODIFYthequeryTOaccommodateaboveresults.