Returns information about primary key constraints created with the create table or alter table command for a single table.
sp_pkeys table_name [, table_owner] [, table_qualifier]
is the name of the table. The use of wildcard characters in pattern matching is not supported.
is the name of the table owner. The use of wildcard characters in pattern matching is not supported. If table_owner is not specified, sp_pkeys looks for a table owned by the current user and then for a table owned by the Database Owner.
is the name of the database that contains the table. This can be either the current database or NULL.
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. Adaptive 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.
Any user can execute sp_pkeys.
Copyright © 2005. Sybase Inc. All rights reserved. |