Displays information about primary keys and primary key constraints by table, column, table owner, or for all SAP Sybase IQ tables in the database.
One or more of the parameters can be specified. If you do not specify either of the first two parameters, but specify the next parameter in the sequence, you must substitute NULL for the omitted parameters. If none of the parameters are specified, a description of all primary keys on all tables in the database is displayed. If any of the specified parameters is invalid, no rows are displayed in the output.
Syntax |
Output |
---|---|
sp_iqpkeys sales |
Displays information about primary keys defined on table sales |
sp_iqpkeys sales, NULL, DBA |
Displays information about primary keys defined on table sales owned by DBA |
sp_iqpkeys sales, store_id, DBA |
Displays information about primary key defined on column store_id of table sales owned by DBA |
sp_iqpkeys NULL, NULL, DBA |
Displays information about primary keys defined on all tables owned by DBA |
The sp_iqpkeys stored procedure displays the following information about primary keys on base and global temporary tables in a database:
Column name |
Description |
---|---|
table_name |
The name of the table |
table_owner |
The owner of the table |
column_name |
The name of the column(s) on which the primary key is defined |
column_id |
The column ID |
constraint_name |
The name of the primary key constraint |
constraint_id |
The primary key constraint ID |
sp_iqpkeys sales1 table_name table_owner column_name column_id constraint_name constraint_id sales1 DBA store_id 1 MA114 114
sp_iqpkeys sales2 table_name table_owner column_name column_id constraint_name constraint_id sales2 DBA store_id, 1,2 MA115 115 order_num
sp_iqpkeys sales2, store_id table_name table_owner column_name column_id constraint_name constraint_id sales2 DBA store_id 1 MA115 115