The explicit name of a new partition, partition_name returns the partition name of the specified data or index partition id.
partition_name(indid, ptnid[, dbid])
is the index ID for the target partition.
is the ID of the target partition.
is the database ID for the target partition. If you do not specify this parameter, the target partition is assumed to be in the current database.
Returns the partition name for the given partition ID belonging to the base table (with an index ID of 0). The lookup is done in the current database because it does not specify a database ID:
select partition_name(0, 1111111111)
Returns the partition name for the given partition ID belonging to the clustered index (index ID of 1 is specified) in the testdb database.
select partition_name(1, 1212121212, db_id("testdb")
If the search does not find the target partition, the return is NULL.
Functions data_pages, object_id, partition_id, reserved_pages, row_count