SQL Server 2000中FOR XML PATH的替代方案

编程入门 行业动态 更新时间:2024-10-28 08:19:32
本文介绍了SQL Server 2000中FOR XML PATH的替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我的要求是在SQL Server 2000中编写一个查询。场景是: 假设一个表有两列ID(不是主键)和Name。价值如下 - ID名称 1 A 1 B 1 C 2 D 2 E 然后我必须查询此表以获得类似 的输出ID名称 1 A,B,C 2 D,E 我写了一个查询同样使用FOR XML PATH但在SQL Server 2000中不支持但在2005/2008年运行良好。此外,我尝试添加一些额外的逻辑来获得此输出,但由于输入表很大,导致性能不佳。但是在2005年在同一个表上使用FOR XML PATH查询需要时间输出。 所以,请告诉我可能替换FOR XML的内容PATH在2000年。 我尝试过XML AUTO,但是这会给出XML结果,所以如果你的建议是使用XML AUTO,请写下查询。 非常感谢任何帮助。 谢谢, Ankit J.

Hi All, My requirement is to write a query in SQL Server 2000. Scenario is: Suppose a table has two columns ID(not primary key) and Name. Values are like- ID Name 1 A 1 B 1 C 2 D 2 E then I have to query this table to get the output like ID Name 1 A,B,C 2 D,E I have written a query for the same using FOR XML PATH but that does not supported in SQL Server 2000 but works good in 2005/2008. Also I tried to put some extra logic to get this output but it results in bad performance as the input table is huge. But using FOR XML PATH query on the same table in 2005 it takes to time to output. So, please let me know what can be the possible replacement of FOR XML PATH in 2000. I tried XML AUTO but that is giving XML results so please write the query if your suggestion is to use XML AUTO. Any help is highly appreciated. Thanks, Ankit J.

推荐答案

请参阅下面的文章,我已经解释了大部分可能性。 生成和拆分分隔的字符串列 [ ^ ] See my article below, I have explained most of the possibilities. Generating and splitting a delimited string column[^]

更多推荐

SQL Server 2000中FOR XML PATH的替代方案

本文发布于:2023-10-19 00:09:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1505837.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方案   Server   SQL   PATH   XML

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!