Partition functions

  • How do you find the range values of an existing partition function or filegroups of partition scheme?

  • sys.partition_range_values


    * Noel

  • Full code:

    SELECT

    object_name(i.[object_id]) AS table_name,

    ps.name AS partition_scheme,

    pf.name AS partition_function,

    dds.destination_id AS partition_number,

    fg.Name AS file_group_name,

    (CASE WHEN boundary_value_on_right = 1

    THEN 'RIGHT' ELSE 'LEFT' END) AS range_type,

    prv.value AS range_value

    FROM sys.indexes i

    INNER JOIN sys.partition_schemes ps

    ON ps.data_space_id = i.data_space_id

    INNER JOIN sys.partition_functions pf

    ON ps.function_id = pf.function_id

    INNER JOIN sys.destination_data_spaces dds

    ON dds.partition_scheme_id = ps.data_space_id

    INNER JOIN sys.filegroups fg

    ON fg.data_space_id = dds.data_space_id

    LEFT JOIN sys.partition_range_values prv

    ON prv.boundary_id = dds.destination_id

    WHERE i.type = 1


    * Noel

  • Too good, thanks for the info

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply