从 Sql Server 2005 检索 Xml 输出
大家好,有人可以为我提供一些线索或解决方案来检索记录集,如下所示
注意:我阅读了 MSDN 文档,但除了脱发之外没有任何结果:(
只是假设我有 2 个通过 Rid
连接的表字段
表 1 字段、
Rid,UserName,Hash
表 2 字段
Rid,Phone,City,Email
table1
和 table2
通过 Rid 字段连接
。使用 xml auto、xml 显式或您在 SQL Server Express 2005 中获得的任何 xml 操作的 xml 输出。
预期输出:
<UserDetails>
<Account>
<UserName></UserName>
<Hash></Hash>
</Account>
<Personal>
<Phone1></Phone1>
<City1></City1>
<Phone2></Phone2>
<City2></City2>
</Personal>
</UserDetails>
个人详细信息可以有 n 条记录,但帐户详细信息只有一条。
Hi could someone provide me some clues or solution to retrieve record sets like below
Note: I read the MSDN documentation but leads me nowhere but hair loss :(
Just for the assumption think I have 2 tables connected via Rid
field
Table 1 fields,
Rid,UserName,Hash
Table2 fields
Rid,Phone,City,Email
table1
and table2
are connected via the Rid field.
I would like to have a xml output using xml auto, or xml explicit or which ever xml operations you got in SQL Server Express 2005.
Output expected:
<UserDetails>
<Account>
<UserName></UserName>
<Hash></Hash>
</Account>
<Personal>
<Phone1></Phone1>
<City1></City1>
<Phone2></Phone2>
<City2></City2>
</Personal>
</UserDetails>
The personal details can have n records. But account details are only one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以尝试这个 - 我不能做的是创建那些“嵌入式枚举”,
我不知道有什么方法可以轻松地制作那些按顺序编号的 XML 标签......
我所能做的就是我将在end:
这给了我一个类似的输出:
当然,如果你愿意,你可以添加一个
WHERE t1.rid = xxx
条件到你的外部SELECT
以限制检索到的用户及其详细信息。You could try this - what I cannot do is create those "embedded enumerations"
I don't know of any way to easily make those sequentially numbered XML tags ...
All I can do is the output I'm going to show at the end:
This gives me an output something like:
Of course, if you want, you can add a
WHERE t1.rid = xxx
condition to your outerSELECT
in order to limit the user and its details retrieved.