{"id":468,"date":"2012-09-22T16:40:00","date_gmt":"2012-09-22T16:40:00","guid":{"rendered":"\/blogs\/bobb\/post\/Selective-XML-Indexes-Learning-the-rules-through-error-messages.aspx"},"modified":"2012-09-22T16:40:00","modified_gmt":"2012-09-22T16:40:00","slug":"selective-xml-indexes-learning-the-rules-through-error-messages","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/","title":{"rendered":"Selective XML Indexes &#8211; Learning the rules through error messages"},"content":{"rendered":"<p>\nExperimenting without docs is a good way to get lots of error messages along the way. I&#39;m learning by attrition, and it seems like I&#39;d be better off knowing the rules. It&#39;s not the best way to learn anything, but you can at least learn the limits through the error messages. I was tired of trying seemingly random things and being surprised, so I decided to look for &quot;selective XML index&quot; error messages.\n<\/p>\n<p>\nSo, here&#39;s how to find (or imply) &quot;the rules&quot; for Selective XML Indexes.\n<\/p>\n<p>\n&#8212; Ids 662, 970, 2735, 6342, 6343 and 6367-6399 and 9535-9539 inclusive<br \/>\nselect message_id, text from sys.messages <br \/>\nwhere language_id = 1033<br \/>\nand text like &#39;%selective XML%&#39;;\n<\/p>\n<p>\nNow some of these are general (parameterized) error messages, so you won&#39;t get exact limits in terms of numbers. But, I tried the catagorize and summarize these for my own use. Here&#39;s some interesting ones.\n<\/p>\n<p>\n1. Not all SQL data types are supported (not surprising)<br \/>\n2. Not all XQUERY (XSD) data types are supported (there were some surprises here, like xs:integer not supported)<br \/>\n3. Selective XML indexes&#39; typing can&#39;t contradict types in an XML SCHEMA COLLECTION<br \/>\n4. Selective XML indexes&#39; typing can affect new data you try and add. For example, if the types don&#39;t match the SXI-defined types&nbsp;and you&#39;re not using an XML SCHEMA COLLECTION.<br \/>\n5. You can&#39;t index a non-leaf node for the value or use * wildcard as the last step in the path.<br \/>\n6. There is a maximum depth to the path in a pathspec.\n<\/p>\n<p>\nAnd so on&#8230; you can read &#39;em as well as I can.\n<\/p>\n<p>\nHopefully, this, and the previous entries should be enough to get you started. I did write these in one sitting and most of them were written in &quot;realtime&quot; so if you have any additions, questions, and\/or find something neat to do with these drop me a line by email (be creative, figure out my email address) or ping me on twitter.\n<\/p>\n<p>\nMotivation in the next (which is also the last, for now) posting.\n<\/p>\n<p>\n@bobbeauch<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Experimenting without docs is a good way to get lots of error messages along the way. I&#39;m learning by attrition, and it seems like I&#39;d be better off knowing the rules. It&#39;s not the best way to learn anything, but you can at least learn the limits through the error messages. I was tired of [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,37],"tags":[],"class_list":["post-468","post","type-post","status-publish","format-standard","hentry","category-sql-server-2012","category-sql-server-xml"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Selective XML Indexes - Learning the rules through error messages - Bob Beauchemin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Selective XML Indexes - Learning the rules through error messages - Bob Beauchemin\" \/>\n<meta property=\"og:description\" content=\"Experimenting without docs is a good way to get lots of error messages along the way. I&#039;m learning by attrition, and it seems like I&#039;d be better off knowing the rules. It&#039;s not the best way to learn anything, but you can at least learn the limits through the error messages. I was tired of [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/\" \/>\n<meta property=\"og:site_name\" content=\"Bob Beauchemin\" \/>\n<meta property=\"article:published_time\" content=\"2012-09-22T16:40:00+00:00\" \/>\n<meta name=\"author\" content=\"Bob Beauchemin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bob Beauchemin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/\",\"name\":\"Selective XML Indexes - Learning the rules through error messages - Bob Beauchemin\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\"},\"datePublished\":\"2012-09-22T16:40:00+00:00\",\"dateModified\":\"2012-09-22T16:40:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server 2012\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/sql-server-2012\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Selective XML Indexes &#8211; Learning the rules through error messages\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\",\"name\":\"Bob Beauchemin\",\"description\":\"SQL Server Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\",\"name\":\"Bob Beauchemin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"caption\":\"Bob Beauchemin\"},\"sameAs\":[\"http:\/www.sqlskills.com\/blogs\/bobb\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Selective XML Indexes - Learning the rules through error messages - Bob Beauchemin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/","og_locale":"en_US","og_type":"article","og_title":"Selective XML Indexes - Learning the rules through error messages - Bob Beauchemin","og_description":"Experimenting without docs is a good way to get lots of error messages along the way. I&#39;m learning by attrition, and it seems like I&#39;d be better off knowing the rules. It&#39;s not the best way to learn anything, but you can at least learn the limits through the error messages. I was tired of [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/","og_site_name":"Bob Beauchemin","article_published_time":"2012-09-22T16:40:00+00:00","author":"Bob Beauchemin","twitter_misc":{"Written by":"Bob Beauchemin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/","name":"Selective XML Indexes - Learning the rules through error messages - Bob Beauchemin","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website"},"datePublished":"2012-09-22T16:40:00+00:00","dateModified":"2012-09-22T16:40:00+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/selective-xml-indexes-learning-the-rules-through-error-messages\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/"},{"@type":"ListItem","position":2,"name":"SQL Server 2012","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/sql-server-2012\/"},{"@type":"ListItem","position":3,"name":"Selective XML Indexes &#8211; Learning the rules through error messages"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/","name":"Bob Beauchemin","description":"SQL Server Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e","name":"Bob Beauchemin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","caption":"Bob Beauchemin"},"sameAs":["http:\/www.sqlskills.com\/blogs\/bobb\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/468","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/comments?post=468"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/468\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/media?parent=468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/categories?post=468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/tags?post=468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}