Return a List of Partition Functions in SQL Server (T-SQL)

You can use the sys.partition_functions system catalog view to return a list of partition functions in SQL Server.

Example

Here’s an example to demonstrate.

SELECT * FROM sys.partition_functions;

Result:

+-------------------------+---------------+--------+-------------+----------+---------------------------+-------------+-------------------------+-------------------------+
| name                    | function_id   | type   | type_desc   | fanout   | boundary_value_on_right   | is_system   | create_date             | modify_date             |
|-------------------------+---------------+--------+-------------+----------+---------------------------+-------------+-------------------------+-------------------------|
| MoviesPartitionFunction | 65542         | R      | RANGE       | 4        | 0                         | 0           | 2020-10-12 22:50:23.300 | 2020-10-12 22:50:23.300 |
+-------------------------+---------------+--------+-------------+----------+---------------------------+-------------+-------------------------+-------------------------+

To save you from scrolling sideways, here it is again using vertical output:

name                    | MoviesPartitionFunction
function_id             | 65542
type                    | R 
type_desc               | RANGE
fanout                  | 4
boundary_value_on_right | 0
is_system               | 0
create_date             | 2020-10-12 22:50:23.300
modify_date             | 2020-10-12 22:50:23.300

In this case, I only have one partition function, and so that is listed.

The sys.partition_functions view requires membership in the public role.