{"id":2819,"date":"2017-02-27T23:02:40","date_gmt":"2017-02-28T07:02:40","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/kimberly\/?p=2819"},"modified":"2021-11-11T15:47:30","modified_gmt":"2021-11-11T23:47:30","slug":"sp_helpindex-v20170228","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/sp_helpindex-v20170228\/","title":{"rendered":"(OLD): sp_helpindex"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"2819\" class=\"elementor elementor-2819\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-b730ca3 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"b730ca3\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-461fd1db\" data-id=\"461fd1db\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-54c550c6 elementor-widget elementor-widget-text-editor\" data-id=\"54c550c6\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h2>IMPORTANT UPDATE:<\/h2><p>PLEASE REVIEW THIS POST FOR THE UPDATED SCRIPTS: <a href=\"https:\/\/www.sqlskills.com\/blogs\/kimberly\/use-these-updates-to-sqlskills-index-procedures\/\">USE THESE: Updates to SQLskills Index Procedures<\/a><\/p><p>****************************************************<\/p><p>Since I\u2019ve rewritten sp_helpindex a few times, I have a few blogs posts in this category. Each time I do an update I\u2019ll make the NEW version titled USE THIS and I&#8217;ll change all others to (OLD).<\/p><p>The point of this updated version of sp_helpindex is to add details for newer functionality (included columns and filters) as well as better describe what&#8217;s REALLY in your indexes (at the leaf level AND up the b-tree). This particular version won&#8217;t error for new index types AND it&#8217;s &#8220;generic&#8221; and not version specific (meaning you don&#8217;t have to have an sp_SQLskills_SQL2012_helpindex and instead just have one sp_SQLskills_helpindex across versions). You use sp_SQLskills_helpindex in exactly the same way as sp_helpindex; if you can pass it into sp_helpindex then you can pass it into sp_SQLskills_helpindex!<\/p><p>EXAMPLES:<\/p><pre style=\"padding-left: 30px;\"><strong><span style=\"color: #008000;\">sp_helpindex tablename <\/span><\/strong>WORKS<\/pre><pre style=\"padding-left: 30px;\"><strong><span style=\"color: #ff0000;\">sp_helpindex owner.tablename<\/span><\/strong> DOES NOT WORK<\/pre><pre style=\"padding-left: 30px;\"><strong><span style=\"color: #008000;\">sp_helpindex 'owner.tablename'<\/span><\/strong> WORKS<\/pre><p>To setup this\u00a0version of sp_helpindex, you need TWO scripts. Both scripts are generic and work on all versions from SQL Server 2005\u00a0through SQL Server 2016. To produce the detailed output, you need to first create these system procedures.<\/p><h2>Step 1: Setup sp_SQLskills_ExposeColsInIndexLevels<\/h2><p style=\"padding-left: 30px;\"><strong>Create this procedure first:<\/strong> <a href=\"https:\/\/www.sqlskills.com\/resources\/sp_helpindex\/20170228-sp_sqlskills_exposecolsinindexlevels.txt\" target=\"_blank\" rel=\"noopener noreferrer\">sp_SQLskills_ExposeColsInIndexLevels.sql<\/a>\u00a0 (7 kb &#8211; rename download to .sql).<\/p><p style=\"padding-left: 30px;\">This is what gives us the tree\/leaf definitions.<\/p><h2>\u00a0<\/h2><h2>Step 2: Setup the replacement procedure for sp_helpindex -&gt; sp_SQLskills_helpindex<\/h2><p style=\"padding-left: 30px;\"><strong>Create the new sp_helpindex<\/strong>, use: <a href=\"https:\/\/www.sqlskills.com\/resources\/sp_helpindex\/20170228-sp_sqlskills_helpindex.txt\" target=\"_blank\" rel=\"noopener noreferrer\">sp_SQLskills_helpindex.sql<\/a>\u00a0 (18 kb &#8211; rename download to .sql) to create sp_SQLskills_helpindex.<\/p><p>Have fun! And, post a comment and\/or shoot me an email if you find any issues!<\/p><p>Thanks for reading,<br \/>Kimberly<\/p><h2>\u00a0<\/h2>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>IMPORTANT UPDATE: PLEASE REVIEW THIS POST FOR THE UPDATED SCRIPTS: USE THESE: Updates to SQLskills Index Procedures **************************************************** Since I\u2019ve rewritten sp_helpindex a few times, I have a few blogs posts in this category. Each time I do an update I\u2019ll make the NEW version titled USE THIS and I&#8217;ll change all others to (OLD). [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,63,79],"tags":[],"class_list":["post-2819","post","type-post","status-publish","format-standard","hentry","category-indexes","category-sp_helpindex-rewrites","category-tools"],"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/posts\/2819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/comments?post=2819"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/posts\/2819\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/media?parent=2819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/categories?post=2819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/kimberly\/wp-json\/wp\/v2\/tags?post=2819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}