John Gallardo's Weblog

From Windows Phone

Browse by Tags

Tagged Content List
  • Blog Post: Using XML value() method to take advantage of a relational index

    The Performance Optimizations for XML Data Type in SQL Server 2005 whitepaper written by Shankar gives some pretty good advice for writing your XQuery statements so that they take advantage of an available XML Index. However, oftentimes you will have to deal with incoming XML data which is represented...
  • Blog Post: Transforming XML data into a rowset using the nodes() method

    Usually there are a couple of scenarios in which you want to take XML data and convert it into a regular relational rowset. In SQL 2000, you probably used OpenXML for this, which works pretty well if you are only working on a single piece of XML data, but as soon as you want to convert a rowset of XML...
  • Blog Post: Using fixed values does not result in smaller instances...

    XML Schema has an interesting feature where you can define a value as being "fixed" . The meaning here is basically that an attribute or element has to have a particular value, and if it is not there in the instance, then that value is implied. However, it is important to realize that this doesn't have...
  • Blog Post: Answer: Fulltext and XML in SQL Server 2005

    A little while ago I threw out this quiz regarding XML and SQL Server 2005's full text search support. As I stated in the quiz, there is a subtle difference between what you can get with contains() and the fulltext support. Specifically, the difference lies in how our full text engine injects whitespace...
  • Blog Post: Quiz: Fulltext and XML in SQL Server 2005

    Using SQL Server's fulltext engine is a great way to optimize your XQuery statements which use XQuery's contains function in a predicate . However, a bit of care has to be taken, because sometimes you might get results which you don't quite expect. Let's assume that I have a fulltext catalog on the...
  • Blog Post: XQuery Contains vs Fulltext Contains

    The XQuery/XPath 2.0 functions and operators specification defines a function called “contains.” It performs a substring match on the two input strings and returns true if the value of the 2nd string is contained in the value of the 1st string. An example: select convert(xml, '').query('contains("foo...
  • Blog Post: Building an RSS reader in SQL Server 2005

    People used to write "Hello, World!" applications in order to demo new languages and technologies. It seems that all of the demos de jour are RSS applications. Well, in order to continue the trend, I have decided to write a quick RSS reader which uses 2 major new SQL Server 2005 features: the XML Datatype...
  • Blog Post: Seeking on the XML Value Index

    This might be long, so I am going to cut to the chase right now. If you are using predicates which involve non-string types in your XQuery statements, you want to use typed data. There, I said it. Now lets try to figure out why. The issue basically boils down to how we index our XML data in SQL Server...
  • Blog Post: Why is there a 128-byte limit on the primary key for tables with a Primary XML Index?

    One error that you may run into when attempting to create a Primary XML Index is the following: Msg 6336, Level 16, State 201, Line 1 Maximum size of primary index of table 'StorageTable' is 900 bytes. CREATE XML INDEX requires that such size should be limited to 128 bytes It is pretty self-explanatory...
  • Blog Post: Consequences of redefining the default element namespace

    Check out Mike's entry regarding namespaces in XQuery. I wanted to illustrate one more point regarding the consequences when namespace prefix bindings affect both query and construction. It is about the default element namespace. The real problem hits when you are querying data which is in the empty...
  • Blog Post: Answer: Comparisons in XQuery vs T-SQL

    Last week I threw out this simple little quiz . Here is the answer. The first query will return 1 or 0 rows, depending on what the default collation in your database is. On my machine, which uses the default out-of-the-box collation "SQL_Latin1_General_CP1_CI_AS" returned a single row. The second...
  • Blog Post: Quiz: Comparisons in XQuery vs T-SQL

    I have the following two statements. What is the difference? What would you expect the results to be? Are you surprised by what you get? select 1 where convert(xml, '<foo>bar</foo>').value('/foo[1]', 'nvarchar(4)') = 'Bar' go select 1 where convert(xml, '<foo>bar</foo>...
  • Blog Post: Denis talks about XQuery static typing in SQL Server 2005

    Denis is one of my fellow SDETs on the SQL Server Engine team. He just started a blog about XSD in SQL Server. http://blogs.msdn.com/denisruc/archive/2005/06/13/428726.aspx Static Typing is one of those things that causes a bit of confusion at first for people, but eventually they come around and...
  • Blog Post: Answer: SQL Server 2005 'exist' method

    Last week I threw out a quick quiz about the XML datatypes 'exist' method. The reason it was at the top of my mind was that it was a mistake that I had made only a couple of days before. Not only that, but even a couple of my peers didn't recognize the mistake when I showed it to them. We all knew the...
  • Blog Post: Quiz: SQL Server 2005 XML 'exist' method

    Among the features introduced in SQL Server 2005 is the new XML Datatype . You can use this guy to store both untyped and typed XML information and maintain the infoset fidelity of the document. We support a subset of the XQuery language which can be used to retrieve values from XML instances and reshape...
Page 1 of 1 (15 items)