使用带有 FOR XML AUTO、ELEMENT 的存储过程更改架构
现在我正在
<Header>
<data1> </data1>
<Line>
<data> </data>
<VLine>
<data> </data>
<LUI></LUI>
</Vline>
</Line>
</Header>
通过使用以下存储过程
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
获取像这样的 XML 格式的架构但是我需要在 xml 中获取像这样的架构
<Header>
<data1> </data1>
<Line>
<data> </data>
<VLine>
<data> </data>
</Vline>
<LUI>
<data> </data>
</LUI>
</Line>
</Header>
我应该如何更改上面的存储过程以获得这样的架构?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个,没有经过我测试,所以里面可能有很多错别字。
用它来测试子查询是否有效,看起来确实有效。
结果:
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: