I attended the Building Database Applications with SQL Server “Yukon”: XQuery, XML Datatype session this morning by Arpan Desai and Istvan Cseri. This covered the variety of new features in the next SQL Server release to do with processing XML.
It’s funny because just 3 weeks ago, I was searching through Google looking for XML databases. Nothing that I found then provided anything like the simplicity found in Yukon, where XML becomes a first class column type, and I can’t wait for this to reach production release.
One of the worries with querying XML data stored in a column is performance. Clearly you can’t immediately benefit from the query optimiser built into SQL, but Microsoft have added the ability to create an XML index on your data that pulls out the various elements and attributes and which in many cases allows queries on your XML to be performed without needing to hit the individual field value. This is cool stuff.
XML columns in your tables can be associated with an appropriate XSD schema. This means that you can only add valid data to that field and that strong types can be derived about your data from the schema.
With built in support for XQuery, you can search across your XML data and then transform the results into a new XML document with whatever structure you like. XQuery can look quite complex but help is at hand with a drag-and-drop XQuery editor built into the Yukon SQL Server Workbench that actually works really well.