如何获取“select for xml”?输出到多个文件?
我们的客户抱怨我们的导出文件太长;他们希望我们将导出分成许多文件,每个文件不超过“n”条记录。有没有办法通过“select for xml”来做到这一点
目前我们在这个项目中使用Sql Server 2005。
(如果这太难了,我总是可以对单个大文件进行后期处理以将其拆分)
Our customer is complaining that our export file is too long; they would like us to split the export into many files with no more than “n” records per file. Is there a way of doing this with “select for xml”
At persent we are using Sql Server 2005 for this project.
(If this is too hard, I can always post process the single large file to split it up)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这里没有什么简单易行的事情可以做。
我的方法可能是限制每个 SELECT 语句返回的行数(通过按某些条件(例如按日期或位置等)对返回的数据进行分区),然后将这些较小的 XML 流一一放入文件中。可行,但不是很优雅或复杂。
I don't think there's anything simple'n'easy you can do here.
My approach would probably be to limit the number of rows returned by each SELECT statement (by partioning the data returned by some criteria, e.g. by date or location or something), and then put those smaller XML streams into files one by one. Doable, but not very elegant or sophisticated..