问题
How I can find the list of Indexes for a given database in Sybase?
回答1:
Query against sysobjects and sysindexes:
SELECT o.name,
i.name
FROM sysobjects o
JOIN sysindexes i
ON (o.id = i.id)
Documentation on the interpretation of the sysobjects and sysindexes system tables is available on the Sybase web-site.
Load up stored procedure library from http://www.edbarlow.com/ and type in sp__helpindex
or use the Sybase-provided sp_helpindex which expects the table-name as a parameter.
回答2:
SELECT Object_name(id)
FROM sysindexes si
WHERE indid > 0
回答3:
To get a complete list of indexes in Sybase ASE we can use the following query -
select si.* from sysobjects so, sysindexes si where so.id = si.id and si.indid > 0
keepin in mind that a simple select between sysobjects system table and the sysindexes table will give table names along with index names if non-clustered indexes exists. Check the following link for more information -
Sybase ASE - How to find index list in a sybase database
回答4:
In Sybase version SAP IQ/16, you can get list of indexes with following (table name my_table is case-sensitive):
select *
from sys.sysindexes
where tname = 'my_table';
You may check sybase version as follows:
select @@version
来源:https://stackoverflow.com/questions/1468183/how-i-can-find-the-list-of-sybase-indexes-for-a-given-database