Right now I’m getting schema in XML format like this
<Header>
<data1> </data1>
<Line>
<data> </data>
<VLine>
<data> </data>
<LUI></LUI>
</Vline>
</Line>
</Header>
By using following stored procedure
Select * from
EDI834_5010_Header Header
join EDI834_5010_2000 Line on Header.BGN02__TransactionSetIdentifierCode = Line.Id_BGN02__TransactionSetIdentifierCode
left join EDI834_5010_2300_DTPLoop VLine on Line.REF02_MemberSupplementalIdentifier = VLine.Id_REF02__SubscriberIdentifier and Header.BGN02__TransactionSetIdentifierCode = VLine.Id_BGN02__TransactionSetIdentifierCode
left join EDI834_5010_2300_LUILoop LUI on LUI.Id_BGN02__TransactionSetIdentifierCode=Header.BGN02__TransactionSetIdentifierCode and LUI.Id_REF02__SubscriberIdentifier=Line.REF02_MemberSupplementalIdentifier
for xml auto,ELEMENTS
END
But I need to get the schema like this in xml
<Header>
<data1> </data1>
<Line>
<data> </data>
<VLine>
<data> </data>
</Vline>
<LUI>
<data> </data>
</LUI>
</Line>
</Header>
How should I change my above stored procedure to get the schema like this?
Try this, not tested by me so there may be any number of typos in there.
Used this to test if the sub-queries work and it looks like they do.
Result: