Go Back   CORTEX Forums > Local Happenings > CORTEX Blogs > Random Procrastination
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

Random Procrastination Darren Gosbell is a SQL Server expert and Microsoft 'Most Valued Professional' who works as a Principal Consultant at James & Monroe. His blog covers Business Intelligence, SQL Server, .Net, Powershell and MDX Madness

Reply
 
LinkBack Thread Tools Display Modes
Old 23rd June 2009, 07:30 PM   #1 (permalink)
Member
 
Join Date: Jun 2009
Posts: 35
Darren Gosbell is on a distinguished road
Thumbs up SSAS: Listing Attribute Relationships

Occasionally questions come up about how to extract certain pieces of metadata from Analysis Services. In general all the metadata that you would need on a day to day basis is pretty well covered by the standard schema rowsets. And in SSAS 2008 you can use the system DMVs to get at most of this data.

For example, if you want to get a list of the current user sessions on the server you can do the following...
SELECT * FROM $System.DISCOVER_SESSIONS

...and in SSAS 2005 you can use the same syntax with the DMV() function that is part of ASSP.
call ASSP.DMV("SELECT * FROM $System.DISCOVER_SESSIONS")

But there are some details which can only be accessed through the DISCOVER_XML_METADATA command which returns a hierarchical result similar to what you get when you script an object from SSMS and both the DMV's in SSAS 2008 and the DMV() function in ASSP does not handle this data. Unfortunately the hierarchical information is not the easiest thing to read quickly and is even harder to try to incorporate into a reports.

This is where the DiscoverXmlMetadata() function comes in handy. I wrote this function to use a syntax similar to XPath in order to extract certain nodes. By default the function lists all of the properties of the node it finds which matches the specified path, however you can also add a pipe character (|) after any node and list extra properties that you would like returned

The following call will return a list of all the attribute relationships in the current database:
call assp.DiscoverXmlMetadata("\Database\Dimensions\Dimension|Name\Attributes\Att ribute|Name,Usage\AttributeRelationships\AttributeRelationship")

And if you want to view the relationships for just a single dimension you can use the optional parameter to pass in a predicate in the same form that you would use in an SQL query (provided that you compile the code yourself or use a version greater than the current 1.2 release - as I only recently added this filter parameter)
call assp.DiscoverXmlMetadata("\Database\Dimensions\Dimension|Name\Attributes\Att ribute|Name,Usage\AttributeRelationships\Attribute Relationship"
, "DimensionName='Product'")







More...
Darren Gosbell is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SSAS: Are my Aggregations processed? Darren Gosbell Random Procrastination 0 23rd June 2009 07:30 PM
SSAS: There is no such thing as an Attribute in MDX! Darren Gosbell Random Procrastination 0 23rd June 2009 07:30 PM
SSAS: Executing Arbitrary SQL queries Darren Gosbell Random Procrastination 0 23rd June 2009 07:30 PM
SSAS: T-SQL Equivalent for a Many-to-Many relationship Darren Gosbell Random Procrastination 0 23rd June 2009 07:30 PM
SSAS: Powershell to replace a group member in a role Darren Gosbell Random Procrastination 0 23rd June 2009 07:30 PM


All times are GMT +11. The time now is 09:12 AM.

© The Business Intelligence Group

Search Engine Optimization by vBSEO 3.3.0