0

How to find existing partition names in cube.

I would like to check dynamically whether a partition exist or not using loop in SQL Linked server.

saij
  • 57
  • 2
  • 7

2 Answers2

2

I'm not sure what the compatibility level that you're working with is, but for level 1200 or above the TMSCHEMA_PARTITIONS DMV can be queried from an OPENQUERY linked server connection for tabular models. The Name column will need to be escaped using double brackets as done below. If the model is below compatibility level 1200, I'd recommend using the other answer provided by @vercelli for the DISCOVER_STORAGE_TABLE_COLUMN_SEGMENTS DMV which can also be queried from a linked server.

SELECT 
    * 
FROM OPENQUERY(LinkedServer,
'SELECT 
    [Name] 
FROM $SYSTEM.TMSCHEMA_PARTITIONS')
userfl89
  • 4,610
  • 1
  • 9
  • 17
0

Execute this MDX query:

select distinct
    PARTITION_NAME
from
    $SYSTEM.DISCOVER_STORAGE_TABLE_COLUMN_SEGMENTS 

Founded here

vercelli
  • 4,717
  • 2
  • 13
  • 15