This relationship isn't altogether intuitive but I think this query will get you what you need:
SELECT
PScheme = ps.name,
PFunction = pf.name,
Boundary = dds.destination_id,
BoundaryValue = prv.value,
[Filegroup] = fg.name
FROM sys.partition_schemes AS ps
INNER JOIN sys.partition_functions AS pf
ON ps.function_id = pf.function_id
INNER JOIN sys.destination_data_spaces AS dds
ON ps.data_space_id = dds.partition_scheme_id
INNER JOIN sys.filegroups AS fg
ON dds.data_space_id = fg.data_space_id
LEFT OUTER JOIN sys.partition_range_values AS prv
ON dds.destination_id = pf.boundary_value_on_right + prv.boundary_id
AND prv.function_id = pf.function_id;
And because LEFT
/RIGHT
is always a tedious mental exercise for me, it might be that you need to flip the boundary_value_on_right
part on the second-last line:
ON dds.destination_id = prv.boundary_id + ABS(1-pf.boundary_value_on_right)
You don't need to have created any tables.