How do I get “select for xml” to output to several files?
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)
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..