How can I obtain a list of a SSAS Cube's dimentions and dimentions' attributes
I have a user asking me to list the dimensions and dimension attributes of our SSAS cube.
I susspect I could generate this via AMO, but I'm开发者_C百科 wondering if there's an MDX query or SSMS option to show the same info.
Any ideas?
Here's a script via AMO
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices") | Out-Null
$server = new-Object Microsoft.AnalysisServices.Server
$server.Connect($serverName)
foreach ($db in $server.Databases)
{
Write-Host $db.Name
foreach ($cb in $db.Cubes)
{
Write-Host "`t" + $cb.Name
foreach ($dm in $cb.Dimensions)
{
Write-Host "`t`t" + $dm.Name
foreach ($at in $dm.Attributes)
{
Write-Host "`t`t`t" + $at.Attribute
}
}
}
}
In SQL Server 2008, you can do the following:
- Connect to an Analysis Services server.
- Right-click on a cube, choose New Query -> DMX.
Run the following query
select Dimension_Unique_Name, Property_Name, Property_Caption from $SYSTEM.MDSCHEMA_PROPERTIES where Cube_Name = [YOUR CUBE NAME HERE] And Property_Type = 1
(You can also do select * and get some other information like data_types, cardinality, etc.)
- The whole list of OLAP Schema rowsets can be found at http://msdn.microsoft.com/en-us/library/ms126079.aspx
I had the same issue and I've created a .NET CLR for SQL server that returns a list of SSAS objects.
You can find it here: http://sasokoren.com/export-list-of-ssas-objects-and-translations-using-amo-in-net/
精彩评论