XML Made Easy – LINQ to XML

LINQ to XML is an in-memory XML programming interface that enables XML manipulation. Similar to the more traditional Document Object Model (DOM), LINQ to XML brings XML documents into memory and lets you query and modify them before saving the results to a file or data stream. What is different from the DOM is the new, lighter, and more intuitive object model and LINQ integration.

CodingSight - LINQ to XMl
Read More

XML performance tips

Parsing data from XML using XQuery is a routine practice. In order to do this most effectively, little effort is required.

Suppose we need to parse data from the disk file with the following structure:

<tables>
<table name="Accounting" schema="Production" object="Accounting">
<column name="Date" order="3" visible="1" />
<column name="DateFrom" order="5" visible="1" />
<column name="DateTo" order="6" visible="1" />
<column name="Description" order="4" visible="1" />
<column name="DocumentUID" order="1" visible="0" />
<column name="Number" order="2" visible="1" />
<column name="Warehouse" order="7" visible="1" />
</table>
</tables>

Use BULK INSERT, if you need to read data from a file:

SELECT BulkColumn
FROM OPENROWSET(BULK 'D:\data.xml', SINGLE_BLOB) x sample xml file

Read More