SQL Server 2005: Intro to XQuery

  • Mike C

    SSC-Insane

    Points: 23224

    Comments posted here are about the content posted at http://www.sqlservercentral.com/columnists/mcoles/2840.asp

  • Cory E.

    SSCertifiable

    Points: 7076

    First and foremost, I want to say, I am a DBA.  Can someone tell me why this is getting popular?  I read Steve Jones' article, and this one, and I just don't get it.  What value is there to get results in this format?  Is this a format that is used heavily elsewhere?  Please help me understand why I want to learn this...I am not opposed, just never exposed...

    -- Cory

  • Mike C

    SSC-Insane

    Points: 23224

    Hi Cory,

    You're asking if XML is popular?  Yes, it is very widely used.

    XML is a very popular format, and it is used all over the place.  A couple of examples:  the newest HTML standard (XHTML) is defined as a subset of XML, Web Services use the XML-based SOAP protocol, even Microsoft Word and Excel can save your documents in XML format.  A lot of websites offer XML-based Web Services as well - several of the popular Geocoding and Mapping API's for instance.

    Some of the things that make XML popular are it's human-readable format, its ability to be easily created and read on just about any platform, and the capability of "transforming" an XML document into another XML document very easily.  One very common example is using XSLT to convert an XML document into an XHTML document for display purposes.

  • DCPeterson

    SSCoach

    Points: 15145

    The most straightforward answer to your question is that XML is so popular because of ignorance.

    At the risk of self promotion, I wrote an article on the subject several years ago.  You can find it here:

    http://www.sqlservercentral.com/columnists/dpeterson/isxmltheanswer.asp

    Do yourself a favor, and stay away from XML.

    Michael, you've done a good job of presenting the subject, but it is the subject matter itself that is fatally flawed.

    /*****************

    If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek

    *****************/

  • Mike C

    SSC-Insane

    Points: 23224

    Hi DC -

    You definitely get your point across well in your article.  The only things I would add are:

    1)  You don't need to store native XML in the database in order to take advantage of SQL Server's XML functionality (that seems to be one of your larger concerns); you might have noticed that the XML I used in these articles was not stored in a table on the server

    2)  XQuery provides a simple means of querying your XML data based on just about any criteria you care to use (whether you want to retrieve albums by Artist, Genre, Producer, Label, etc.)

    3)  XML is not designed to be a replacement for the SQL model

    SQL and XML have different goals, different priorities, and I personally believe it's a case of selecting the right tool for the job.  After all is said and done, like SQL, XML is just another tool in the toolbox.

    Thanks!

    Michael

  • Michael David

    SSChasing Mays

    Points: 648

    I use XML to pass multiple records to a Stored Procedure. Since it is not possible to pass a table variable to a SP, XML is the perfect solution since you can hide the result set in XML Nodes...

    Michael.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply