Many database administrators and developers feel uncomfortable with all of the XML support built in the SQL Server 2005 Database Engine. I count myself between database and not application developers; still, I am very impressed with the XML integration.

 

No matter whether you like it o not, XML is nowadays de facto standard in applications. Database management system simply has to deal with it. Developers already search for solutions without a relational database, because they find relational model too restrictive. Object and XML databases are evolving. Nevertheless, does all of this make the relational model obsolete?

 

My answer is no, relational model is far from being obsolete. After all, it bases on a sound mathematical theory, namely set theory. When something bases on a theory, it lifetime is much longer comparing to the lifetime of “best practices”. I admit the relational model is somehow restrictive, but it is restrictive on purpose: a relational database management system has to take care about the data integrity. The problem arises in parts of the model when business rules are not so strict, and the model is prone to often changes. Here is the point where XML takes off. XML documents are very open and easy to change, while they still can have some restrictions with XML schemas.

 

XML data type is the solution that allows you to combine relational and XML data. I mentioned “relational and XML data” because this is a common term in many documents. For example, in SQL Server 2005 Books OnLine you can read (I will leave to the reader to find the sentence), “These features focus on mapping between relational and XML data”. However, I am firmly convinced that the XML data type is just a data type like any other in a relational model, and thus it is simply part of the relational model. Anyway, I am not going to go deeper in the theory in this blog. What I want to say is that with the XML data type now you can simply combine the data that needs stronger constraints using the classical data types like numerics and strings with the data that has changing schema using the XML data type. Therefore, what is now obsolete: relational or XML and object databases? If you were thinking of moving away from the relational database, I would suggest you to think twice!

 

XML data type in SQL Server 2005 is fully-fledged. It supports all of the methods you need; it supports the standard XQuery language within these methods; it supports full-text and XML indexes; it supports schema validation. What is more, it is a standard. The last fact makes is clear winner over the CLR user-defined data type.

 

Of course, the XML data type is not the only XML support in the SQL Server 2005. The OPENXML function and the FOR XML clause known already from SQL Server 2000 are enhanced importantly. There is a very useful new syntax for XML BULK INSERT. All together, because of all of the XML support, I find SQL Server 2005 more useful for real-time business applications than any database management system I had opportunity to use so far.

Dejan Sarka