Writing large xml file - memory issue

I have a large datatable in sql server 2000 with xml code for each row in ntext field.
(about 500000 rows) My normal strategy is to loop through the rows in batch sizes and add the xml elements to a xmldocument in memory and then do xmldocument.save.
In this case it runs out of ram.
Any suggestions how to split this process?
Who is Participating?
Carl TawnSystems and Integration DeveloperCommented:
I think you are going to need to resort to using an XmlWriter, rather than an XmlDocument. This should help you get started:


duke63Author Commented:
OK, I'll give it a try. Think xmlwriter.flush is what I need.
duke63Author Commented:
Works great and fast, thanks!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.