大家好, 我的要求是在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的替代方案
发布评论