How to get partition ranges in SQL 2005

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?

  • Getting first and last values from contiguous ranges
  • How to Stop Inserting?
  • Add new rows with count = 0 present in others groupby group
  • Linq to Entities or EF version of Set Identity_Insert <TableName> ON
  • unable to read a particular cell from excel using reader
  • Dynamic Cross Apply Values
  • T-SQL progressive numbering partitions
  • Restarting numbering within partition once value change
  • Sql Server Dynamic Database Partitioning
  • TSQL OVER CLAUSE That has no partition by has Order By clause
  • How to divide table for parallel loading
  • SQL Server - creating nonclustered Index on specific partitions
  • One Solution collect form web for “How to get partition ranges in SQL 2005”

    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 ('fnPartitionLast30Days')
    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.