Problem solve Get help with specific problems with your technologies, process and projects.

Storing XML data in SQL Server 2005

SQL Server 2005 Expert Adam Machanic discusses storing XML data in SQL Server 2005 using the new XML datatype.

Should I store all of my XML data in SQL Server 2005 using the new XML data type?
Much like CLR UDTs ( link to UDT FAQ ), XML is now a new first-class datatype in SQL Server 2005. Developers may be tempted to use this datatype in order to avoid having to write code to "shred" XML data into tables (i.e. instead of using OPENXML to populate tables with the data.)

Unfortunately, using the XML datatype like this has many of the same problems as representing data in user-defined types. Developers should keep performance in mind, as querying a node of an XML column will require the engine to evaluate a separate XML query for each row of the table. Normalization issues are also present, just as when using CLR UDTs. Ensuring data integrity will be extremely difficult in databases that make too much use of the XML datatype.

Do you have comments on this Ask the Expert Q&A? Let us know.

Dig Deeper on Microsoft SQL Server 2005

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.