How I can find the list of Indexes for a given database in Sybase?
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.
SELECT Object_name(id)
FROM sysindexes si
WHERE indid > 0
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 -
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