sp_pkeys

Returns information about primary key constraints created with the create table or alter table command for a single table.

Syntax

sp_pkeys table_name [, table_owner] [, table_qualifier]

Parameters

Usage

The results set for sp_pkeys is:

Column

Datatype

Description

table_qualifier

varchar(32)

The database name. This field can be NULL.

table_owner

varchar(32)

The table owner. If no value was specified for the table_owner parameter, this value is the current owner or the Database Owner.

table_name

varchar(32)

NOT NULL.

column_name

varchar(32)

NOT NULL.

key_seq

smallint

NOT NULL. The sequence number of the column in a multicolumn primary key.

Primary keys must have been declared with the create table or alter table statement, not with sp_primarykey.

The term primary key refers to a logical primary key for a table. The SAP ASE server expects that every logical primary key has a unique index defined on it and that this unique index is also returned in sp_statistics.

See also alter table, create table in Reference Manual: Commands.

Permissions

Any user can execute sp_pkeys.

Related reference
sp_primarykey
sp_statistics