{"id":67,"date":"2008-06-06T22:42:45","date_gmt":"2008-06-07T03:42:45","guid":{"rendered":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/?p=67"},"modified":"2008-06-12T22:01:41","modified_gmt":"2008-06-13T03:01:41","slug":"ssas-2008-rc0-new-function-systemrestrictschema-for-restricted-schema-rowsets-dmvs","status":"publish","type":"post","link":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/67_ssas-2008-rc0-new-function-systemrestrictschema-for-restricted-schema-rowsets-dmvs","title":{"rendered":"SSAS 2008 RC0 &#8211; New function SYSTEMRESTRICTSCHEMA for restricted schema rowsets &#8211; DMVs"},"content":{"rendered":"<p>In my previous post <a href=\"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/39_katmai-analysis-services-2008-november-ctp5-tests-on-metadata-rowsets\" target=\"_blank\">Katmai Analysis Services 2008 November CTP5 &#8211; tests on metadata rowsets<\/a>\u00a0I listed examples of new SSAS DMVs. But there were few DMVs that you could not query. For example if you would try to execute following\u00a0query:<\/p>\n<blockquote><p>SELECT * FROM $SYSTEM.DISCOVER_PARTITION_DIMENSION_STAT<\/p><\/blockquote>\n<p>You would get this error message:\u00a0<\/p>\n<blockquote><p>The &#8216;DATABASE_NAME&#8217; restriction is required but is missing from the request.<\/p><\/blockquote>\n<p><!--more--><\/p>\n<p>In the SQL Server 2008 RC0 when you execute the same query, you will get this error message:<\/p>\n<blockquote><p>Errors from the SQL query module: The &#8216;DATABASE_NAME&#8217; restriction is required but is missing from the request.\u00a0 Consider using SYSTEMRISTRICTSCHEMA to provide restrictions.<\/p><\/blockquote>\n<p>There is small spelling mistake (<a href=\"https:\/\/connect.microsoft.com\/SQLServer\/feedback\/ViewFeedback.aspx?FeedbackID=349575\" target=\"_blank\">connect<\/a>) in this message: SYSTEMRISTRICTSCHEMA should be SYSTEMRESTRICTSCHEMA. That is new function that can be used to query restricted schema rowsets.<\/p>\n<p>Different schema rowsets require different restrictions and there also could be different restriction count for each rowset schema. Here are examples of how this new function can be used on different schema rowsets that contain restrictions:<\/p>\n<p>Query for $SYSTEM.DISCOVER_DIMENSION_STAT schema rowset:<\/p>\n<blockquote><p>SELECT *<br \/>\n\u00a0 FROM SYSTEMRESTRICTSCHEMA (<br \/>\n\u00a0 $SYSTEM.DISCOVER_DIMENSION_STAT<br \/>\n, DIMENSION_NAME = &#8216;Date&#8217;<br \/>\n, DATABASE_NAME=&#8217;Adventure Works DW&#8217;<br \/>\n)<\/p><\/blockquote>\n<p>Result will be:<\/p>\n<blockquote><p>\u00a0<\/p>\n<table border=\"1\">\n<tbody>\n<tr>\n<td>DATABASE_ NAME<\/td>\n<td>DIMENSION_ NAME<\/td>\n<td>ATTRIBUTE_ NAME<\/td>\n<td>ATTRIBUTE_ COUNT<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Date<\/td>\n<td>1159<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Calendar Quarter<\/td>\n<td>14<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Fiscal Quarter<\/td>\n<td>14<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Calendar Semester<\/td>\n<td>8<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Fiscal Semester<\/td>\n<td>8<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Day of Week<\/td>\n<td>8<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Day Name<\/td>\n<td>8<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Day of Month<\/td>\n<td>32<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Day of Year<\/td>\n<td>366<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Week of Year<\/td>\n<td>54<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Month Name<\/td>\n<td>39<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Calendar Year<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Fiscal Semester of Year<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Calendar Semester of Year<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Fiscal Quarter of Year<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Calendar Quarter of Year<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Date<\/td>\n<td>Month of Year<\/td>\n<td>13<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00a0<\/p><\/blockquote>\n<p>Query for $SYSTEM.DISCOVER_INSTANCES schema rowset:<\/p>\n<blockquote><p>\u00a0SELECT *<br \/>\n\u00a0 FROM SYSTEMRESTRICTSCHEMA(<br \/>\n\u00a0 $SYSTEM.DISCOVER_INSTANCES<br \/>\n, INSTANCE_NAME=&#8217;MSSQLSERVER&#8217;<br \/>\n)<\/p><\/blockquote>\n<p>Result will be:<\/p>\n<blockquote><p>Empty result set<\/p><\/blockquote>\n<p>Query for $SYSTEM.DISCOVER_PARTITION_DIMENSION_STAT schema rowset:<\/p>\n<blockquote><p>SELECT * FROM SYSTEMRESTRICTSCHEMA(<br \/>\n\u00a0 $SYSTEM.DISCOVER_PARTITION_DIMENSION_STAT<br \/>\n, CUBE_NAME = &#8216;Adventure Works&#8217;<br \/>\n, DATABASE_NAME = &#8216;Adventure Works DW&#8217;<br \/>\n, MEASURE_GROUP_NAME = &#8216;Sales Orders&#8217;<br \/>\n, PARTITION_NAME=&#8217;Total_Orders_2004&#8242;<br \/>\n)<\/p><\/blockquote>\n<p>Result will be:<\/p>\n<blockquote>\n<table border=\"1\">\n<tbody>\n<tr>\n<td>DATABASE_ NAME<\/td>\n<td>CUBE_ NAME<\/td>\n<td>MEASURE_ GROUP_ NAME<\/td>\n<td>PARTITION_ NAME<\/td>\n<td>DIMENSION_ NAME<\/td>\n<td>ATTRIBUTE_ NAME<\/td>\n<td>ATTRIBUTE_ INDEXED<\/td>\n<td>ATTRIBUTE_ COUNT_MIN<\/td>\n<td>ATTRIBUTE_ COUNT_ MAX<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Sales Summary Order Details<\/td>\n<td>(All)<\/td>\n<td>FALSE<\/td>\n<td>1<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Sales Summary Order Details<\/td>\n<td>Sales Order Number<\/td>\n<td>FALSE<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Sales Summary Order Details<\/td>\n<td>Sales Order<\/td>\n<td>FALSE<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Sales Summary Order Details<\/td>\n<td>Sales Order Line<\/td>\n<td>FALSE<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Sales Summary Order Details<\/td>\n<td>Carrier Tracking Number<\/td>\n<td>FALSE<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Sales Summary Order Details<\/td>\n<td>Customer PO Number<\/td>\n<td>FALSE<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Date<\/td>\n<td>(All)<\/td>\n<td>FALSE<\/td>\n<td>1<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Date<\/td>\n<td>Fiscal Year<\/td>\n<td>TRUE<\/td>\n<td>4<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Date<\/td>\n<td>Fiscal Semester<\/td>\n<td>TRUE<\/td>\n<td>5<\/td>\n<td>7<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Date<\/td>\n<td>Fiscal Quarter<\/td>\n<td>TRUE<\/td>\n<td>12<\/td>\n<td>14<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Date<\/td>\n<td>Month Name<\/td>\n<td>TRUE<\/td>\n<td>32<\/td>\n<td>38<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Date<\/td>\n<td>Date<\/td>\n<td>TRUE<\/td>\n<td>916<\/td>\n<td>1128<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>Date<\/td>\n<td>Calendar Year<\/td>\n<td>TRUE<\/td>\n<td>5<\/td>\n<td>5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/blockquote>\n<p>Query for $SYSTEM.DISCOVER_PARTITION_STAT schema rowset:<\/p>\n<blockquote><p>SELECT *<br \/>\n\u00a0 FROM SYSTEMRESTRICTSCHEMA(<br \/>\n\u00a0 $SYSTEM.DISCOVER_PARTITION_STAT<br \/>\n, CUBE_NAME=&#8217;Adventure Works&#8217;<br \/>\n, DATABASE_NAME = &#8216;Adventure Works DW&#8217;<br \/>\n, MEASURE_GROUP_NAME = &#8216;Sales Orders&#8217;<br \/>\n, PARTITION_NAME=&#8217;Total_Orders_2004&#8242;<br \/>\n)<\/p><\/blockquote>\n<p>Result will be:<\/p>\n<blockquote>\n<table border=\"1\">\n<tbody>\n<tr>\n<td>DATABASE_ NAME<\/td>\n<td>CUBE_ NAME<\/td>\n<td>MEASURE_ GROUP_ NAME<\/td>\n<td>PARTITION_ NAME<\/td>\n<td>AGGREGATION_ NAME<\/td>\n<td>AGGREGATION_ SIZE<\/td>\n<\/tr>\n<tr>\n<td>Adventure Works DW<\/td>\n<td>Adventure Works<\/td>\n<td>Sales Orders<\/td>\n<td>Total_Orders_2004<\/td>\n<td>\u00a0<\/td>\n<td>45548<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/blockquote>\n<p>Query for $SYSTEM.DISCOVER_PERFORMANCE_COUNTERS schema rowset:<\/p>\n<blockquote><p>SELECT *<br \/>\n\u00a0 FROM SYSTEMRESTRICTSCHEMA(<br \/>\n\u00a0 $SYSTEM.DISCOVER_PERFORMANCE_COUNTERS<br \/>\n, PERF_COUNTER_NAME = &#8216;\\MSAS 2008:Cache\\Current KB&#8217;<br \/>\n)<\/p><\/blockquote>\n<p>Result will be:<\/p>\n<blockquote>\n<table border=\"1\">\n<tbody>\n<tr>\n<td>PERF_COUNTER_NAME<\/td>\n<td>PERF_COUNTER_VALUE<\/td>\n<\/tr>\n<tr>\n<td>\\MSAS 2008:Cache\\Current KB<\/td>\n<td>3606<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/blockquote>\n<p>Special thanks to Edward Melomed to clarifying syntax of this new function.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous post Katmai Analysis Services 2008 November CTP5 &#8211; tests on metadata rowsets\u00a0I listed examples of new SSAS DMVs. But there were few DMVs that you could not query. For example if you would try to execute following\u00a0query: SELECT * FROM $SYSTEM.DISCOVER_PARTITION_DIMENSION_STAT You would get this error message:\u00a0 The &#8216;DATABASE_NAME&#8217; restriction is required [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,6],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/wp-json\/wp\/v2\/posts\/67"}],"collection":[{"href":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/wp-json\/wp\/v2\/comments?post=67"}],"version-history":[{"count":0,"href":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/wp-json\/wp\/v2\/posts\/67\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/wp-json\/wp\/v2\/media?parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/wp-json\/wp\/v2\/categories?post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ssas-info.com\/VidasMatelisBlog\/wp-json\/wp\/v2\/tags?post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}