Get great amount of data with T-SQL for xml
I’m creating some big xml files to test performance of linq to xml to make some PoC. I use simply the ForXml to extract data from Customer and Orders table of northwind database, The first Xml is 517 Kb, but I need really bigger file.
The trick is simple I created another table called insertHelper that contain a single column, and I filled with numbers from 1 to 100:
Now I simply issue this query to create a very big xml file
|
|
This makes me happy because now I have the original customer x 100 record, I have ALFKI1, ALFKI2..ALFKI100 and so on, thanks to the cross join SQL operator. The problem is that the XMl returned is so big that when I try to open in the Sql Server management Studio I received an “Insufficent memory” because the XML is too big. The solution is to use this fragment of code.
|
|
This is not good snippet, it lack using for SqlCommand (that is disposable) but it serves me only to create the file thanks to the ExecuteXmlReader functino of the SqlCommand.
The file is 60Mb big, and is a good candidate to make some load test of linq to XML.
Alk.
Tags: ForXml Linq to XML