Microsoft SQL Server 检索分区边界值

示例

SELECT       ps.nameAS PartitionScheme
            ,fg.nameAS [FileGroup]
            , prv.*            
            , LAG(prv.Value) OVER (PARTITION BYps.nameORDER BY ps.name, boundary_id) AS PreviousBoundaryValue

FROM       sys.partition_schemesps
INNER JOIN   sys.destination_data_spacesdds
            ONdds.partition_scheme_id= ps.data_space_id
INNER JOIN   sys.filegroupsfg
            ONdds.data_space_id= fg.data_space_id
INNER JOIN   sys.partition_functionsf
            ONf.function_id= ps.function_id
INNER JOIN   sys.partition_range_valuesprv
            ONf.function_id= prv.function_id
            ANDdds.destination_id= prv.boundary_id