A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: System Functions

partition_id()

The system function partition_id() returns the identification number (id) for the specified partition. If this partition does not exist, the return value is NULL. The function partition_id() is available in ASE starting with version 15.0.

Syntax of the System Function partition_id()

    partition_id("table_name", "partition_name" [,"index_name"])
    

The Parameters of the System Function partition_id()

All parameters must be set in single or double quotes. The function partition_name() can be used across databases by specifying the optional parameter "db_id". If the parameter "db_id" is not specified, partition_id() is executed in the current database.

"table_name"
The parameter "table_name" is the name of a table, on which the partition is located. The "table_name" is stored in the column "name" of the system table sysobjects. The table must be in the database on which the function is exectuted. If this is not the case, the parameter "table_name" must be specified fully qualified, i.e. using the name of the target database, the table owner and the table name.

"partition_name"
The parameter "partition_name" describes the name of the partition is question. It can be retrieved from the column "name" in the system table syspartitions.

"index_name"
The parameter "index_name" is the name of an index on the table specified. It can be retrieved from the column "name" in the system table sysindexes.

Example for the System Function partition_id()

    select partition_id("sysobjects", "sysobjects_1")
    go

Determines die identification number (id) of the partition "sysobjects_1".

    select partition_id("sysobjects", "sysobjects_1", "sysobjects")
    go

Determines the id of the partition Partition "sysobjects_1" and the index "sysobjects" in the current database.

    select partition_id("master.dbo.sysobjects", "sysobjects_1", "sysobjects")
    go

Determines the id of the partition "sysobjects_1" and the index "sysobjects" of the master database, across databases.

See also:

ASE T-SQL - Aggregate Functions,
audit_event_name(),
col_length(),
col_name(),
curunreservedpgs(),
datachange(),
datalength(),
data_pages(),
data_pgs(),
db_id(),
db_name(),
host_id(),
host_name(),
identity(),
index_col(),
index_colorder(),
isnull(),
lct_admin(),
license_enabled(),
lockscheme(),
next_identity(),
object_id(),
object_name(),
pagesize(),
pointer_size(),
ptn_data_pgs(),
reserved_pages(),
reserved_pgs(),
rowcnt(),
row_count(),
showplan_in_xml(),
syb_sendmsg(),
syb_sendmsg(),
System Functions,
tempdb_id(),
tran_dumpable_status(),
tsequal(),
used_pages(),
used_pgs().