partition_name

Description

The explicit name of a new partition, partition_name returns the partition name of the specified data or index partition id.

Syntax

partition_name(indid, ptnid[, dbid])

Parameters

indid

is the index ID for the target partition.

ptnid

is the ID of the target partition.

dbid

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.

Examples

Example 1

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)

Example 2

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")

Usage

See also

Functions data_pages, object_id, partition_id, reserved_pages, row_count