• I like the question. I don't think it's a trick question - many people here are so used to using case insensitive collations (stupid defaults!!!) that they can and will be caught by this XML feature. Probably numerous times. I know I have, it's probably the main reason I got it right.

    And the second good thing about the question is that it also makes you think about what would have been returned if the case had been correct. I know I was not really sure of that (I'm far from an XML expert!), so I was happy that the lower-/uppercase thing gave me a guaranteed point, and the rest of the question gave me the opportunity to play with the code and see what happens if I change the case - so this has also taught me something about the XQuery data function. (And if I just happen to stumble on it again within a week or so, it might even stick this time).


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/