Importing Large Xml Files to SQL Server Using SqlBulkCopy

15 ביוני 2009

Say you have a large Xml file that contains relatively tabular data that you want to import into SQL Server. There are several ways to go about this. Let’s look at a couple of options. Load the file into an XDocument. Extract elements from the DOM using Linq and then use ADO.Net to insert the data into the database. Load the data into a DataSet using ReadXml and save the data to the database Read through the data using an Xml reader and save each record to the database Options number 1 and 2 requires that we load the...

Multi-Threading is Hard – Who do you trust?

4 ביוני 2009

Something has been bothering me for quite some time and I am frankly not entirely sure what to do. I have been working on a multi-threaded server application for over a year and feel that I have a decent grasp on multi-threading. More importantly, I have learned to respect the complexity. So what is bothering me? Over the last few months I have encountered a number of blog posts that propose some solution with code that multi-threaded. The problem – It’s Wrong! Sometimes I send an email to the author, but for the most...