Back To Basics: Getting Data from an XML Document

One of the most popular ways to get data multiple pieces of data in a single parameter from one stored procedure to another, or from a client application to the database is to use XML. This can be done in SQL Server 2000 by using the NTEXT (or TEXT) datatype, and in SQL 2005 using the XML datatype. (In SQL Server 2008 you can use Table variable input parameters.)

Being able to use this XML data means knowing how to work with XML documents, as well as knowing how to use XPath. For many DBAs working with XPath is very new. Until now its been pretty much the domain of developers.

I would normally put a whole bunch of source code here, but I posted some earlier this year in my “XML in the database. What’s the big deal any way?” posting, so I’ll simply refer you back to it.



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trust DCAC with your data

Your data systems may be treading water today, but are they prepared for the next phase of your business growth?