How to get partition ranges in SQL 2005
-
06-07-2019 - |
Question
I have a partitioned table in SQL Enterprise 2005. I need to query the PARTITION FUNCTION to find it's partition ranges. What SQL query will give me those values?
Solution
Got this from the SQL profiler watching the management studio generate the script for creating the function
SELECT sprv.value AS [Value],
sprv.boundary_id AS [ID]
FROM sys.partition_functions AS spf
INNER JOIN sys.partition_range_values sprv
ON sprv.function_id=spf.function_id
WHERE (spf.name=N'fnPartitionLast30Days')
ORDER BY [ID] ASC
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow