uch of the buzz surrounding the release of SQL Server Yukon seems to be about its new integration with the CLR. However, there are plenty of other worthwhile features in this lastest releaseand at least one of them can make your database application programming whole a lot easier. Besides CLR integration, Yukon also offers three new XML support features that effectively eliminate the use of middle-tier components.
With SQL Server 2000, you needed datatypes like varchar or text to store XML data. Furthermore, there was no chance to query XML data directly on the database tier. You read your XML data in strings and passed them to the middle-tier components, which would then query against the XML data. The resulting XML was shown through the use of XSL transformations. Obviously, this was not a very elegant approach.
Yukon's three new XML support features allow you to interact directly with your XML data.
- The new XML datatype allows you to store native data inside Yukon.
- Yukon allows you to run queries against XML data with XQuery or XPath. You can also embed XQuery statements directly into T-SQL statements. XML schemas allow you to assign a schema to the new XML datatype, so you can ensure that your XML data always matches the specified XML schema.
- The XML Data Modification Language (XML DML) allows you to update XML data through the use of T-SQL statements. XML indices are used when you need a performance boost.
One way to think about the new datatype (xml) is to see it as similar to datatypes like varchar, datetime, or float. You can use it to declare columns, parameters, or variables.
This new datatype allows you to:
- Store XML data in a typed form. To accomplish this a XML schema must be registered within Yukon and assigned to the XML datatype.
- Store XML data in an untyped form.
- Query against the XML data directly in T-SQL statements or stored procedures, using query languages like XQuery or XPath.
- Update XML data directly in T-SQL statements or stored procedures, using the new XML Data Modification Language (XML DML).
- Create indices on XML datatype columns, improving database performance.